[Haskell-cafe] Network.Socket Woes

Josh Myer josh at joshisanerd.com
Fri Mar 7 13:39:40 EST 2008

On Fri, Mar 07, 2008 at 10:56:32AM -0700, Scott Bell wrote:
> Adam,
> This does the trick, thanks! I certainly would not have been
> able to track down such an insidious `issue' without much
> agony and despair.

(haskell-cafe, my apologies for a message that's only tangentially
on-topic.  The content might be helpful, especially if you're writing
socket apps.)

Assuming you're on Linux, there are a few handy tools for this job:

 * 'netstat -nlp'     (show listeners, with process name, numeric)
 * lsof -p $pid               (list open file descriptors for PID)
 * strace -p $pid          (trace system calls in running process)
 * strace /path/to/executable       (trace system calls to stderr)
 * ls -l /proc/$pid/fd   (peek at kernel's view of PID's fd table)

There's also dtrace on Solaris and OS X, but I don't use those OSes,
so I'm not too familiar with it.  In Windows, there seems to be an
embarassment of riches when it comes to profiling tools.

Hope this helps,
/jbm, but you can call me Josh.  Really, you can!

More information about the Haskell-Cafe mailing list