Search code examples
pythonlinuxsocketsnetwork-traffic

tracing Linux socket calls?


I've got a Python library I am trying to debug (pyzeroconf). The following code returns '34' as if the data was sent down the socket but I can't see those packets on 2 different wireshark equipped PCs.

bytes_sent = self.socket.sendto(out.packet(), 0, (addr, port))

I am at the point where I need to understand what's going on down the call stack. Is there a way to trace what's happening?

Resolution: the problem was related to the "bind address" the library was figuring out as default. A value of "0.0.0.0" isn't allowed and fails (at least on Linux) silently.


Solution

  • you can use strace, e.g.

    $ strace -o logfile -e trace=network cmdline