Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4017848
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:54:41+00:00 2026-05-20T09:54:41+00:00

Helloes good people of Stack Overflow, I have a .NET client-server application running with

  • 0

Helloes good people of Stack Overflow,
I have a .NET client-server application running with a few hundred of clients. The project was migrated from VB6 to .NET about a year ago and it’s a platform for card/board games.
Although I’ll be trying to give as much detail as I can below, the problem is getting a channel frozen when there are 40-70 players inside.

Architecture

1. Server (.NET 4.0)

  • Divided into three projects: ServerNET, Listener, Channel
  • Listener acts like a login server where clients connect first. It is responsible for checking stuff like version and account info.

    Also lets the client choose which channel to connect. It’s basicly a TCPListener in a do-while, listening anyone trying to connect forever. It is not the reason why both sides get frozen.

  • Channel represents a single port, clients get connected to Channels after they are done with Listener. Much like a space shuttle, this is the main part. Similar to a MIRC channel, it binds all users inside, most of the data is sent to people within the same channel like chat and the games you can join created by other players, hosted by server. This is a console application and serves as a hub for players. Player info is held in “Client” class which includes a TCPClient and some other properties. Each client runs with a thread and makes async calls which are handled by the server. Also these “Client” objects are held in a collection class named “ClientCollection”. Channel gets frozen when there are roughly 40-70 players inside. There is a maximum limit of 100 players permitted per channel.
  • ServerNET is the body and does all other general stuff related by the whole system, not channel spesific. This is a form-application and runs stuff like server options.

2. Client (.NET 2.0)

  • Runs with TCPClient, mostly single thread whereas server is multi-thread.
  • Must use .NET 2.0.
  • Mostly consisting of visuals and other non-important stuff.

When there are 40+ clients connected to a single channel, it starts to get frozen totally randomly (or that’s what we have right now, got no evidance or enough datas to point out what’s totally wrong). We really don’t think network traffic is the issue (not quite sure yet) since we have tried it on different server machines with various setups. All the server machines we have used are capable of handling that much of process hardware-wise. So it is about the approach and what’s going on code side.

The reason why we are struggling to address the issue is we are not exactly sure what could be causing it. Please check out the following example:
System A has 55 people online in their Channel #1 and it doesn’t get frozen anyhow. System A uses A1 IP and the channel is on 16xxx port.
System B has 25 people online in their Channel #4 and it gets frozen like one or two minutes randomly. System B uses B1 IP and 18xxx for the channel port. It’s on the same machine with System A which doesn’t get frozen.

As a conclusion, it looks irrelevant with the number of online people but it occurs more often when numbers rise.

We tried rolling an Application.DoEvents() in an endless do-loop in Channel project thinking that some X process causing the channel to go frozen state for a few minutes, thus resulting a pause in channel. Then it performs every action which was queued while it was frozen, in a few seconds. CPU usage is averagely between 7%-20% per channel, it looks like it is getting better. However it was no permanant and effective solution.

Things we suspect:

  • ClientCollection that holds players and TCPClients is inherited from CollectionBase. Maybe this is causing some chaos during sync’ing. This used to be an array back in the day and we were having less of these problems. Maybe it shouldn’t be inherited from CollectionBase, but something else?
  • We are using SyncLock (lock in C#) to sync ClientCollection. (although we had this problem before we started using locks)

Server info
Intel Xeon X3460 2.80GHz
16 GB RAM
64-bit Windows Server 2008 Enterprise

I know it is impossible to address the issue without seeing the whole code, but I regret that I’m unable to post the codes. Instead I’m looking for an idea to put me into some direction. However we are happy to share any other info for resolving this problem.

Thanks to everyone helping!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T09:54:41+00:00Added an answer on May 20, 2026 at 9:54 am

    We had a very similar problem on a very similar app (ours pushed out stats to ~1300 users).

    My best guess is that on your TCPClient, you have an infinite timeout set. This is, unfortunately, the default behavior. So, when TCPClient blocks on a read, it sometimes gets completely frozen.

    Set the timeout to 30 seconds (or something more suitable to your situation).

    TcpClient newClient = incoming.AcceptTcpClient();
    newClient.NoDelay = true;  // Send & receive immediately, even when the buffers aren't full
    newClient.ReceiveTimeout = 30000;
    newClient.SendTimeout = 30000;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say, I have a string hello is it me you're looking for I want
Has someone ever used isReliable with the Google Translate API? It always returns undefined
How do I replace all occurrences of a substring with another string, for std::string
I've been able to create a small activex control, but it requires the dll
I've been trying to implement a bash script that reads from wordnet's online database
Here is a command line script for a dictionary lookup using Wordnet: #!/bin/bash #
Possible Duplicate: highlighting search results in php/mysql I am doing a search with a
Why doesn't this C# typecheck? In this example, I am trying to pass a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.