?
Solved

TCP datastream message length

Posted on 2000-03-17
2
Medium Priority
?
187 Views
Last Modified: 2010-04-02
Hi,

I am programming a TCP Client in VC++6.0 (using WinSock DLL 2.0, stream socket) that recieves messages having different lengths from the Server. The message length is not included in the message and no special end-character is used. Nevertheless, I need to know where one message stops and the next message begins.

How can I do this ?
Thanxs.
0
Comment
Question by:chivo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
MichaelS earned 280 total points
ID: 2627627
No way, you can do it only if you will change protocol. Send, for example, at the beginning of every message somekind of "heade" with fixed lenght and information about size of message which will follow after...
0
 
LVL 3

Expert Comment

by:ufolk123
ID: 2630635
Hi chivo,
It is only possible if you use UDP.
Actually you can implement some protocol in which using UDP you can do retransmisions and stuff to ensure relability at a user level.This might be combursome but is only solution if you dso not want to put length headers in your data packets.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question