Click here to Skip to main content
13,045,657 members (66,545 online)
Rate this:
Please Sign up or sign in to 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!

Posted 27-Apr-13 9:13am
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.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 27 Apr 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100