Solved

TCP datastream message length

Posted on 2000-03-17
2
178 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now