Solved

TCP datastream message length

Posted on 2000-03-17
2
180 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
2 Comments
 
LVL 6

Accepted Solution

by:
MichaelS earned 70 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
FMX enumerated colours 2 98
Find Visual Studio Tools 2 102
How to remove Recent Projects from Embarcadero C++ builder XE10. Berlin 2 55
c++, dynamic object by json 1 42
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

776 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