Hi,
I'm using java socket a client side,
i have a server that sends data
packets, I read, decode, .....
I have trouble getting all the data sent by the server,
what I receive is a sequence of packets 1,2,3 ...
I receive 1 then 2 and when I read the next it is number
4 or 5.
I have no exceptions !
how can it happen !!!
can a matter of size/buffering mechanism .... make me
avoid this ?
(the server is "solid", and the data is really sent)
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Danny Woods
Mohamed Naoufel Ben Salah writes:
I have trouble getting all the data sent by the server, what I receive is a sequence of packets 1,2,3 ... I receive 1 then 2 and when I read the next it is number 4 or 5.
The first question would have to be whether you're using a Socket or DatagramSocket? If it's a DatagramSocket, then missing or out-of-order data is just a fact of life: if you require reliable data transfer over UDP, you'll need some additional protocol to detect missing data and re-request holes in the packet stream (something that the server will have to support).
If it's a plain TCP-based java.net.Socket and you're receiving data out of order, then something's seriously amiss, as the protocol itself explicitly protects against this (failing rather than missing data or delivering it unordered).
In any case, the Ethereal network analysis tool is invaluable for tracking this kind of stuff down (http://www.ethereal.com). Provided the client and the server are on different machines, you'll be able to tell exactly which data is being sent to/from your box (it doesn't work with the loopback address).
Failing that, posting some code might allow people to help more effectively.
Regards,
Danny.
Mohamed Naoufel Ben Salah <Mohamed-Naoufel.Ben_Salah@alcatel.fr> writes:
I have trouble getting all the data sent by the server,
what I receive is a sequence of packets 1,2,3 ...
I receive 1 then 2 and when I read the next it is number
4 or 5.
The first question would have to be whether you're using a Socket or
DatagramSocket? If it's a DatagramSocket, then missing or out-of-order data
is just a fact of life: if you require reliable data transfer over UDP, you'll
need some additional protocol to detect missing data and re-request holes in
the packet stream (something that the server will have to support).
If it's a plain TCP-based java.net.Socket and you're receiving data out
of order, then something's seriously amiss, as the protocol itself
explicitly protects against this (failing rather than missing data or
delivering it unordered).
In any case, the Ethereal network analysis tool is invaluable for tracking
this kind of stuff down (http://www.ethereal.com). Provided the client
and the server are on different machines, you'll be able to tell exactly
which data is being sent to/from your box (it doesn't work with the loopback
address).
Failing that, posting some code might allow people to help more effectively.
I have trouble getting all the data sent by the server, what I receive is a sequence of packets 1,2,3 ... I receive 1 then 2 and when I read the next it is number 4 or 5.
The first question would have to be whether you're using a Socket or DatagramSocket? If it's a DatagramSocket, then missing or out-of-order data is just a fact of life: if you require reliable data transfer over UDP, you'll need some additional protocol to detect missing data and re-request holes in the packet stream (something that the server will have to support).
If it's a plain TCP-based java.net.Socket and you're receiving data out of order, then something's seriously amiss, as the protocol itself explicitly protects against this (failing rather than missing data or delivering it unordered).
In any case, the Ethereal network analysis tool is invaluable for tracking this kind of stuff down (http://www.ethereal.com). Provided the client and the server are on different machines, you'll be able to tell exactly which data is being sent to/from your box (it doesn't work with the loopback address).
Failing that, posting some code might allow people to help more effectively.