Solved

TCP datastream message length

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

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

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…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

691 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