TomHL <To***@discussions.microsoft.com> wrote:
I want to send an additional info with byte array wiith sockets as "one
packet".
I know how to send the byte array by himself, but how can I send the
additional info with it at the same time (as one packet)?
thx for yout answers.
Firstly, you can't guarantee that information you send on a socket will
be sent in a single packet, and you shouldn't rely on it. Sockets give
*streams* of data, and that's how the information should be thought of.
Now, as to sending "additional information" - that will have to be part
of the data sent. You could, for instance, have a sort of "header"
section before the data, potentially including the length of the data
as well as other bits of information. It will be part of the data
received, however, so the other end will need to know that there'll be
that header section first.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog:
http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too