Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Sockets
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 27-Apr-13 10:13am
Comments
Sergey Alexandrovich Kryukov at 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)

  Print Answers RSS
0 BillWoodruff 260
1 Mathew Soji 244
2 Afzaal Ahmad Zeeshan 232
3 OriginalGriff 231
4 Maciej Los 230
0 OriginalGriff 6,419
1 Sergey Alexandrovich Kryukov 6,008
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 4,070


Advertise | Privacy | Mobile
Web04 | 2.8.1411019.1 | Last Updated 27 Apr 2013
Copyright © CodeProject, 1999-2014
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