netdev
[Top] [All Lists]

Re: Opening more than 65000 sockets

To: Nivedita Singhvi <nivedita@xxxxxxxxxx>
Subject: Re: Opening more than 65000 sockets
From: Yan-Fa Li <yanfali@xxxxxxxxx>
Date: Fri, 29 Mar 2002 15:26:56 -0800 (PST)
Cc: netdev@xxxxxxxxxxx
In-reply-to: <OF3BF40451.1F9C7A69-ON88256B8B.00779772@boulder.ibm.com>
Sender: owner-netdev@xxxxxxxxxxx
Thank you for the insight!  I re-coded it with more
error checking, my bad, and caught that I was using setsockopt()
incorrectly, wrong level, and then made the program specify ports to
bind to and now everything seems to work great!  100K outgoing
ports opened successfully.  Awesome!

Here's design question, so I have a lot of timewait sockets on exiting
and I've set my fin_timeout to 5 seconds and they seem to
disappear eventually (within a minute or so).  I noticed I can set
SO_LINGER and make the client send a RST and get out of this state
faster, allowing me to restart the client sooner.  I realize this is
valid TCP behavior but is it typical network client behavior say from
a browser versus doing the correct handshake ?

Y

--- Nivedita Singhvi <nivedita@xxxxxxxxxx> wrote:
> 
> Er, thats not exactly how it works.
> 
> The problem is youre not specifying a port to bind to, which
> means the kernel is going to look for a free port. (in your case,
> there isnt any, and bind() returns an EINVAL).
> 
> The SO_REUSEADDR option allows you to reuse a particular
> port, its not useful when you have wildcarded the port.  (the kernel
> cant arbitrarily pick a port to reuse).
> 
> So if you pick a particular port - all your connections will use the
> same port - probably what you want is to do this in a loop and
> specifically assign unique ports and reuse them ..
> 
> You might want to error check after each call to correctly identify
> when youre getting an error. :)
> 
> Hope that helps..
> 
> thanks,
> Nivedita
> 
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Greetings - send holiday greetings for Easter, Passover
http://greetings.yahoo.com/

<Prev in Thread] Current Thread [Next in Thread>