On Fri, 2007-01-26 at 19:06 -0800, Eric Cheng wrote:
> On Fri, Jan 26, 2007 at 06:55:48PM -0800, Adam Leventhal wrote:
> > I'm writing a program that needs to accept network connections, but the
> > actual port number doesn't matter, and I'd like the kernel (or someone) to
> > choose an available port for me. Does this functionality exist?
> 
> binding to port 0 should work.

And you can use getsockname() after the bind to see what the kernel
picked.

                                        - Bill

_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to