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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:46:46+00:00 2026-05-11T14:46:46+00:00

I am developing an application in C#, using the server-client model, where the server

  • 0

I am developing an application in C#, using the server-client model, where the server sends a byte array with a bitmap to the client, the client loads it into the screen, sends an ‘OK’ to the server, and the server sends another image, and so on.

The length of the image buffer deppends, usually it is between 60kb and 90kb, but I’ve seen that it doesn’t matter. If I put the client and the server in the same computer, using localhost, everything works fine. The server does beginSend, and the client does endReceive and the whole buffer is transmitted.

However, I am now testing this in a wireless network and what happens is:

  • The server sends the image.
  • The callback function data_received on the client is called, but there are only 1460 bytes to read (MTU – why? shouldn’t only be in UDP?)
  • The callback function data_received on the client is called again, now with the rest of the buffer (either it be 1000 bytes or 100 kbytes)…

It’s always like this, a first packet with 1460 bytes is received, and then the second packet contains the rest.

I can work around this by joining both byte arrays received, but this doesn’t seem right. I’m not even sure why this is happening. Is it some restriction on the network? Why then doesn’t C# wait for the whole data to be transmitted? I mean, it’s TCP, I shouldn’t have to worry about it, right?

Anyway, any help would be great!
Cheers

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

    It’s TCP – you should treat the data as a stream. You shouldn’t care how the stream is broken up into packets, or make assumptions about it.

    If you need to receive a single ‘block’ of data, the simplest way to do that reliably is to prefix it with the length (e.g. as a 32-bit value). You read the length (noting that even those bytes could be split across multiple packets) and then repeatedly read (whether synchronously or asynchronously) taking note of how much you read each time, until you’ve read all the data.

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

Sidebar

Ask A Question

Stats

  • Questions 191k
  • Answers 191k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer As a ASP.NET developer, I know you can do this… May 12, 2026 at 6:05 pm
  • Editorial Team
    Editorial Team added an answer Simply place the following attributes in the button : runat="server"… May 12, 2026 at 6:05 pm
  • Editorial Team
    Editorial Team added an answer You need to maintain your own database. The payload that… May 12, 2026 at 6:05 pm

Related Questions

I am developing an application where i want i am displaying a dataset in
I am developing my first multilingual C# site and everything is going ok except
Setup: I'm creating a .NET WinForms application in C# to allow our technical support
I am preparing for the development of an enterprise-style application for a very small

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.