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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T04:25:13+00:00 2026-06-19T04:25:13+00:00

Using TCP Sockets, my client/server has a situation where messages are being sent from

  • 0

Using TCP Sockets, my client/server has a situation where messages are being sent from the client, and the server is receiving and writing them to file. The problem im running into is for some reason even though I have the messages being split up, they are all being recieved on one line.

So for example.. say im sending a text file line by line using:

socket->write(msg.toUtf8().constData());
    socket->waitForBytesWritten(5000);

The server sometimes receives multiple messages all in one receive.

So if the text file said:

hello,

this is the client

Sometimes the server will receive “hello this is the client”, receiving both messages together when they should have been separate.

Someone might say i coded it wrong then, but the weird thing is, if i test the client/server locally, it all works perfect. As soon as i do it over a network this problem starts to happen. I did some testing adding in delays between sending messages. This also fixed the problem, but only after I increased the delays to nearly 1 second per message. This is a problem if a large number of messages need to be sent, 1 second each eventually takes a long time.

  • 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-06-19T04:25:14+00:00Added an answer on June 19, 2026 at 4:25 am

    Remember that TCP is a streaming protocol. There are no natural message boundaries, data is just a stream of bytes.

    If you want messages to be separated, you have to add a protocol on top of TCP which includes these boundaries. For text, newlines are a natural boundary and are used in many text-based protocols.

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

Sidebar

Related Questions

I have a TCP socket client receiving messages (data) from a server. messages are
I'm using select() to recv() messages from server, using TCP/IP. When I send() messages
I am using C++ TCP/IP sockets. According to my requirements my client has to
I am using TCP/IP sockets to create a client and server applicaton. Originally I
Lately, when using my TCP/IP Server and Client, I has noticed that they both
I'm implementing a client/server pair, commnicating through TCP/IP sockets, using overlapped IO with completion
I'm making an application server client using tcp sockets in c# .. The application
I implemented a TCP Client using a thread opening a socket to a server
My TCP server is implemented using Netty. My client using vanilla java.net.Socket to connect
I have a java server which is using TCP and sockets to connect to

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.