MVP please help - WSAENOBUFS problem

  • Thread starter Thread starter Valerie Hough
  • Start date Start date
V

Valerie Hough

Hi,
My application uses System.Net.Sockets.Socket class (asynchronously) to
implement record sharing. There is a central task that accepts two way
connections from multiple clients. There are usually 20-30 sockets open at a
given time, but possibly as may as 50-60. As the client uses the software,
it usually works fine for several hours, then slows down and eventually
generates a WSAENOBUFS error (An operation on a socket could not be
performed because the system lacked sufficient buffer space or because a
queue was full.) Pertinent information:

0) WSAENOBUFS is always reported by client task and never server task.

1) When a client shuts down, it does:
Socket.Shutdown( SocketShutdown.Both );
Socket.Close();

2) Sockets are opened by client and kept open for the life of the client.

3) Messages sent back and forth are always quite small, usually 40-160
bytes. An average of 40-50 messages in total per minute are sent at peak
usage.

4) Maximum number of connecting tasks ranges from 4-25 or so.

5) Server task is always OK.

This feels like a resource leak of some sort on the client side, but it
seems as though the code is as per the documentation.

Can anyone suggest what might be wrong or think of further investigation to
undertake?

Thanks in advance.
Brian Hough
 
Have you tried disposing of your socket , set a timeout for say 15
seconds and making a brand new socket and try reconnecting.

Another question might be, how big is the buffer that you are providing
for receiving data. I generally set mine to 1k or 1.5k. Generally
1.2-1.5k is usually the largest a single packet will ever get.
 
Back
Top