lkml.org 
[lkml]   [1999]   [Oct]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject"1024 Sockets per process" or "TIME WAIT without an ending"
I am writing a client/server program in userspace. The server listens() on a
socket and does a pthread_create() when a connection comes in and listens()
on...
The created thread answers the request and then shutsdown() and closes() the
socket filedescriptor. I am checking for errors and non occure. everything
fine.

Now I wanted to check 'multi-threaded-ness' of the mini-progi and start a
client with
# while (echo 1); do (client localhost;) done

It seems to work fine until the 1024th connection is requested.
then everything halts (both programs, not the system. That keeps running.)

#netstat -an
tells me, that around 1024 ports are in use and they all have the status TIME
WAIT.

It takes some time until all sockets are freed again. then I can rerun the
experiment.

Why are the ports in 'TIME WAIT' status? Were they not closed properly? Can I
speed this process up? Where is the problem?

Even if I leave client and server after they halted and wait till all the TIME
WAIT -connections ended, they do not run on. I would have expected that at
least.
#netstat -an
shows just the server listening and nothing else.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:54    [W:0.477 / U:0.460 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site