Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi, I am writing a client/server program using C# winsock classes. The multi-threaded server (1 thread per client connection) sends small chunks of data to clients. For performance reason I try to use BeginSend instead of Send. It seems to be working fine. The only problem I am encountering is that every a few hours the BeginSend stops sending data and the client has to reconnect to receive more data. So I tried to add the EndSend callback on the server and problem still remains. On the client side I am only using Receive instead of BeginReceive and I am not using semaphores in the server code. Does anyone has an idea why this is so? Thanks a lot!

xg
Posted
Comments
Sergey Alexandrovich Kryukov 27-Apr-13 21:24pm    
One thread per client connection is quite a bad schema, not really leveraging the power of threads; it can be used only of you can guarantee reasonably small number of clients. It's easy to build a relatively simple multi-connection service with just two communication threads (one to accept new connection, another one working with all the clients).

The problem you have is impossible to analyze without having some code sample from you.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900