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 6953095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:26:04+00:00 2026-05-27T14:26:04+00:00

Here I am troubleshooting a theoretical problem about HOW servers and clients are working

  • 0

Here I am troubleshooting a theoretical problem about HOW servers and clients are working on machines. I know all NET Processes, but I am missing something referring to code. I was unable to find something related about this.

I code in Visual C# 2008, i use regular TCPClient / TCPListener with 2 different projects:

Project1 (Client)

Project2 (Server)

My issues are maybe so simple:

1-> About how server receives data, event handlers are possible?
In my first server codes i used to make this loop:

while (true)
{

if (NetworkStream.DataAvailable)
    {
        //stuff
    }

Thread.Sleep(200);
}

I encounter this as a crap way to control the incoming data from a server. BUT server is always ready to receive data.

My question: There is anything like…? ->

AcceptTcpClient();

I want a handler that waits until something happen, in this case a specific socket data receiving.

2-> General networking I/O methods.

The problem is (beside I’m a noob) is how to handle multiple data writing.
If I use to send a lot of data in a byte array, the sending can break if I send more data. All data got joined and errors occurs when receiving. I want to handle multiple writes to send and receive.

Is this possible?

  • 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-27T14:26:05+00:00Added an answer on May 27, 2026 at 2:26 pm

    About how server receives data, event handlers are possible?

    If you want to write call-back oriented server code, you may find MSDN’s Asynchronous Server Socket Example exactly what you’re looking for.

    … the sending can break if I send more data. All data got joined and errors occurs when receiving.

    That is the nature of TCP. The standardized Internet protocols fall into a few categories:

                 block oriented    stream oriented
    reliable          SCTP              TCP
    unreliable         UDP              ---
    

    If you really want to send blocks of data, you can use SCTP, but be aware that many firewalls DROP SCTP packets because they aren’t “usual”. I don’t know if you can reliably route SCTP packets across the open Internet.

    You can wrap your own content into blocks of data with your own headers or add other “synchronization” mechanisms to your system. Consider an HTTP server: it must wait until it reads an entire request like:

    GET /index.html HTTP/1.1␍␊
    Host: www.example.com␍␊
    ␍␊
    

    Until the server sees the CRLFCRLF sequence, it must keep the partially-read data in a buffer. The bytes might come in one at a time in a dozen or more packets. Or, if the client is sending multiple requests in a single stream, a dozen requests might come in a single packet.

    You just have to handle this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Perhaps I'm missing a major point of the x64 platform here, but my perception
I just asked a question here, about why an iframe_resize function wasn't working. After
Here's a problem I ran into recently. I have attributes strings of the form
Here's a coding problem for those that like this kind of thing. Let's see
Here's an interesting problem. On a recently installed Server 2008 64bit I opened IE
I´m facing a huge problem since a couple weeks. I´ve an asp.net application hosted
I read about using the CASE expression inside the WHERE clause here: http://scottelkin.com/sql/using-a-case-statement-in-a-sql-where-clause/ I'm
I realize that this question has been asked and has been answered here but
I've been doing C# for years but ASP.NET for not so long and this
Can someone offer troubleshooting tips here?: With the following sequence of rails related commands:

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.