Saturday, 31 August 2013

Efficient use of sockets in c#

Efficient use of sockets in c#

I am using Sockets in C#.
I am using this to connect:
client = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
client.Connect(remoteEP);
I send a message using client.send...
I receive a message using client.receive...
I have read to maximise the performance of using sockets I should use
Ayscn Sockets.
Is this true and is there an optimised buffer number to use? e.g
buffer[256] (etc).
Also, on the Server side I assign a thread to an incoming client request.
Once the work is completed i close the socket. I have found this a good
way to manage clients but I have also found suggestions that this is not
the best way to go. Really just need advice on the best way to go and why.
thanks..

No comments:

Post a Comment