Home All Groups Group Topic Archive Search About
Author
9 Feb 2006 11:01 AM
Zeeshan Gulzar
I am using MSDN Sample Code of "Using Asynchronous Server Socket (C#)" in a
windows service running
under Local System Account named Listener Service.

Client Code is also Asynchronous(C#) and embed in Windows Service running
under Local System Account
named Dispatcher Service.

This service works as follows:

1. Get message from Message Queue (MSMQ)
2. Connect to server at port 4000 (This machine is connected with server
machine via Modem
   Both Start "Routing and Remote Access Service" just before Listener &
Dispatcher Services starts).
3. Send Message to server and close the socket immediately (Not set Linger
option. default setting used)
4. When client connected with server, server get Socket from ENDAccept(),
store in State class etc.
   (Complete code is from MSDN Sample Code mentioned above.)
5. Server Received the message and close the socket immediately (Default
Setting of socket is used).

Problem is here:

After about an hour, server reject to accept new sockets. Netstat -a -p tcp
shows the port 4000 is in
listening state. Client receive Error WSACONNREFUSED.

One thing is that according to MSDN, this problem (Client received
WSACONNREFUSED while server is listening)
occured due to queue of the server is full (backlog). I set backlog of the
socket with 10 using
"socket.listen(10);". But why queue is full, because i receive message from
socket and close it immediately
so this sould returned back to queue. I increase this value to 100 instead
of 10 but problem is still there.
I am using Windows Server 2000.

Is this is the problem of TIME_WAIT. There is no entry of TcpTimedWaitDelay
in my registry.
Accoring to MSDN, this entry exist at
HKEY_LOCAL_MACHINE\System\CurrectControlSet\services\Tcpip\Parameters
Please help me in this regard.

Or could i cope this problem by set linger option of socket to 10 sec or
less. Please help me in this regard also.

Thanks in advance.

AddThis Social Bookmark Button