Server app can't handle 230+ clients

G

Guest

Hi all,

I am testing how well my server application is connecting to multiple
clients and give and take some information. All actions(connect, accept,
send, receive) are performed by async methods - BeginXXX() and callbacks - in
both server and client sides.

As I increase the number of client connections more than 230, I am getting
socket exception: 10054(An existing connection was forcibly closed by the
remote host) in server application. What was happening was, for that
unsuccessful connections, connections seems to be established well then it's
calling BeginRead() where the exception is being thrown..

Any ideas? How can I decide if it's a performance issue?

Bob

<server side>

ClientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
ClientSocket.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.ReuseAddress, true);
ClientSocket.Bind(endpoint);
ClientSocket.BeginConnect(ClientIPAddress,
Properties.Settings.Default.ListenPort,
new AsyncCallback(ConnectCallback), myState);

<client side>

// StartListen() function

listener = new TcpListener(IPAddress.Parse(IP), port);
listener.Start(3000);
listener.BeginAcceptSocket(new AsyncCallback(DoAcceptSocketCallback),
listener);

// DoAcceptSocketCallback() function

TcpListener listener = (TcpListener)ar.AsyncState;
Socket soc = listener.EndAcceptSocket(ar);
listener.BeginAcceptSocket(new AsyncCallback(DoAcceptSocketCallback),
listener);
soc.BeginReceive(rxBuf, rxOffset, rxBuf.Length - rxOffset, SocketFlags.None,
new AsyncCallback(ReadCallback), conn);
 
G

Guest

bbg said:
I am testing how well my server application is connecting to multiple
clients and give and take some information. All actions(connect, accept,
send, receive) are performed by async methods - BeginXXX() and callbacks - in
both server and client sides.

As I increase the number of client connections more than 230, I am getting
socket exception: 10054(An existing connection was forcibly closed by the
remote host) in server application. What was happening was, for that
unsuccessful connections, connections seems to be established well then it's
calling BeginRead() where the exception is being thrown..

Any ideas? How can I decide if it's a performance issue?

Try check some of the registry settings in:

http://smallvoid.com/article/winnt-tcpip-max-limit.html

It is just a wild guess, but ...

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top