Re: TCP question

From: Nikolay Petrov (johntup2_nospam__at_mail.bg)
Date: 01/26/05


Date: Wed, 26 Jan 2005 10:53:28 +0200

I thought of way to send some kind of headers, but I am very new to
programming and I don't know how.
I wonder, because data is transferred as Bytes, should the headers be binary
or string.
the simplest thing that I can figure is to use an integer as header and
based on the integer to decide what kind of data is transmitted. Just can't
figure out how to attach the header to the sent data and how to separate it
at the receiver.

"Adam Goossens" <adamgoossens@users.sourceforge.net> wrote in message
news:uBJGJp3AFHA.2792@TK2MSFTNGP15.phx.gbl...
> Hi Nikolay,
>
> All TCP data is transmitted as a series of bytes. It's your responsibility
> to determine a proper higher-level protocol for these bytes so you know
> what you're looking at.
>
> Take the MSN protocol for example. Sometimes you receive a command that
> contains binary data. The first part of the command is a Command String (a
> straight Byte-To-ASCII conversion) which gives you the important
> information about the command (most notably the type of command and the
> length of the incoming data). You download the amount of data the command
> tells you it has sent, and then judge what to do with that data based on
> the command you received.
>
> I personally would do something similar in your server and client. I would
> decide on a protocol to be applied on top of TCP to designate what sort of
> data you are transmitting.
>
> Regards,
> -Adam.
>
> Nikolay Petrov wrote:
>> I need to transfer different types of data from my tcp client to my tcp
>> server - string, bynary, datasets.
>> Ho to know what exactly data I receive?
>>



Relevant Pages

  • Re: Suggestions for custom application-layer protocol?
    ... > the embedded device, and control messages from the monitoring terminal. ... I also want the protocol to be based on TCP/IP. ... > to be sent over a TCP socket? ... field for a command or status code, and put your data in the other fields. ...
    (comp.os.linux.embedded)
  • Re: Suggestions for custom application-layer protocol?
    ... > the embedded device, and control messages from the monitoring terminal. ... I also want the protocol to be based on TCP/IP. ... > to be sent over a TCP socket? ... field for a command or status code, and put your data in the other fields. ...
    (comp.unix.programmer)
  • Re: TCP question
    ... All TCP data is transmitted as a series of bytes. ... Take the MSN protocol for example. ... The first part of the command is a Command String ... sort of data you are transmitting. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Suggestions for custom application-layer protocol?
    ... I also want the protocol to be based on TCP/IP. ... >TCP socket? ... A command is one line of text. ... line identifies what kind of response it is and may ...
    (comp.os.linux.embedded)
  • Re: xPC Binary Fifo Problem
    ... packet could trigger the code to think that it was the ... header of a different command. ... The problem I'm encountering is that the binary header FIFO ... under the serial system has problems with headers that start ...
    (comp.soft-sys.matlab)