Click here to Skip to main content
Rate this: bad
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!
Posted 27-Apr-13 10:13am
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.

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 449
1 Maciej Los 430
2 OriginalGriff 320
3 CHill60 240
4 CPallini 210
0 Sergey Alexandrovich Kryukov 10,102
1 OriginalGriff 9,495
2 Peter Leow 5,241
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 3,076

Advertise | Privacy | Mobile
Web02 | 2.8.150327.1 | Last Updated 27 Apr 2013
Copyright © CodeProject, 1999-2015
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