jldupont
jldupont

Reputation: 96716

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.

Upvotes: 1

Views: 3152

Answers (3)

mguillech
mguillech

Reputation: 336

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.

Upvotes: 0

Ivan Buttinoni
Ivan Buttinoni

Reputation: 4145

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.

Upvotes: 1

maxschlepzig
maxschlepzig

Reputation: 39075

you can use strace, e.g.

$ strace -o logfile -e trace=network cmdline

Upvotes: 4

Related Questions