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 wha开发者_运维技巧t'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.
you can use strace
, e.g.
$ strace -o logfile -e trace=network cmdline
I'm quite sure this not what you expect, but can help: strace -f -F python myscript.py
strace dump the system calls of a generic program.
Why would the INADDR_ANY IP address fail? It shouldn't. From my point of view, something else is missing in your picture. What happens if you try, except the code block, using (errno, string) to get a more descriptive error msg.
精彩评论