I’ve waited for a over a decade, but finally – per process packet tracing on the mac (mountain lion.) For example, finding out the traffic that a python script sends via UDP and the return (both python programs on the same machine); the first sends “foo”, the server sends what it got plus “bar”: # dtrace -n ‘syscall::sendto*:entry /execname == "Python"/ { printf("%s sock=%d sockadd=%x buffer[%d]=%s",execname, arg0, arg4, arg2, […]
Feb 182013