What are the common uses of DatagramPacket ?
Can the DatagramPacket send and recieve more complicated strings then just
an array of bytes ?
Is it common thing to do : sending & recieving more than just array of
bytes, such as sending & recieving objects (or it is generally used by TCP
Socket) ?
Thanks :)
Knute Johnson - 26 Jul 2006 20:28 GMT
> What are the common uses of DatagramPacket ?
>
[quoted text clipped - 5 lines]
>
> Thanks :)
Everything is bytes. The problem comes when you want to make it into
something you recognize. So if you can turn in into bytes and turn it
back you can use Datagrams.

Signature
Knute Johnson
email s/nospam/knute/
Mark Space - 27 Jul 2006 08:00 GMT
> What are the common uses of DatagramPacket ?
In my experience, games and very simple network protocols.
> Can the DatagramPacket send and recieve more complicated strings then just
> an array of bytes ?
> Is it common thing to do : sending & recieving more than just array of
> bytes, such as sending & recieving objects (or it is generally used by TCP
> Socket) ?
Everything is bytes, including TCP. But generally yes I think, TCP is
preferred for more complicated stuff, just because the Transport is
useful, and would have to be re-invented on datagrams.
Chris Uppal - 27 Jul 2006 09:09 GMT
> What are the common uses of DatagramPacket ?
Anything where you don't care if some data doesn't get to the other end or
arives in the wrong order. Some reasons why you might not care:
Because the data just isn't that important;
(e.g. some logging).
Because arriving late is just as bad as not arriving at all;
(e.g. audio streaming).
Because a higher-level of the protocol provides its own checking;
(arguably DNS lookups fit this scenario).
> Can the DatagramPacket send and recieve more complicated strings then just
> an array of bytes ?
No, not unless you convert the "complicated strings" to bytes yourself. Same
goes for TCP/IP transmission (and, come to that, to files too).
-- chris