On Mon, 29 Jan 2007 08:59:20 -0500
Bill Sommerfeld <[EMAIL PROTECTED]> wrote:

> 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.

The storage pointed to by the sockaddr parameter gets modified to
include the port although I don't believe that is standards behavior.

                        mph
_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to