Re: Broken TCP/IP packets



On Apr 11, 12:27 am, "MisterE" <v...@xxxxxxxxxxxxxxx> wrote:
So your reciveing end simply must be written so as it keeps on reading
from the TCP stream up until you have 20 bytes, and store excess bytes
it may have read for the next call. This can easily be implemented
with a ring buffer structure and as many calls to recv() as needed.

If you try to circumvent this, you are fighting against TCP and
potential oddities/requierements of the unterlaying network along the
comunication path.

No converter will break up a 20 byte burst into multiple packets. If this is
happeneing its the worst converter I have ever seen. If the packets were
2,000 bytes then maybe, but I have never seen a converter send while data is
still being recieved. I suspect the user has set a setting wrong on the
device to only allow 10 byte buffer or something. We have 300byte packets
and have NEVER seen on brocken out of hundreds of thousands (I programmed it
to log these and it has never happened).


Snip from MisterE:

I suspect the user has set a setting wrong on the device to only allow 10 byte buffer or something.

10 bytes was just an example as some times i do receive 40 (consisting
on 2 complete packets) bytes too, the point was packet breaking. I
guess that its because of TCP/IP behaviour so there is nothing we can
do unless we switch to some other protocol. Anyway, i've fixed the
issue while making a buffer on converter say for 128 or 256 bytes and
it works fine though technically its not that much real time now. But
i think it should be Ok as TCP/IP is never meant for real time anyway.


thanks for input.
ali


.



Relevant Pages

  • Re: In-tree version of new FireWire drivers available
    ... Just to recap, the dual buffer receive mode, as described in section ... quadlet aligned amount of header data can be appended into one buffer ... *either* the header buffer or the payload buffer fills up. ... enough to hold headers for all the packets it takes to fill up the ...
    (Linux-Kernel)
  • Re: Deaf CAsyncSocket on Windows Service.
    ... To read them out I need a buffer to ... Short packets at the sender are coalesced into longer packets. ... THe receiver says "I have this much buffer space" and the sender is free to send ... You get an OnReceive notification if there is input data to be read. ...
    (microsoft.public.vc.mfc)
  • Re: Cisco 7204VXR Interface ignored packet
    ... Input queue drops (ignored packets) are usually due to buffers not being ... The buffer defaults are good 98% of the ... 256 max cache size, 256 in cache ... 22496866 hits in cache, 0 misses in cache ...
    (comp.dcom.sys.cisco)
  • Re: Waveform Audio - MMSYSERR_INVALPARAM
    ... Also, packets/buffers that you waveOutWrite, are packets ... right after the last sample from the previous buffer seamlessly. ... the waveOutWrite function DON'T return the error. ...
    (microsoft.public.pocketpc.developer)
  • Re: Persistent stall in the Cypress FX2 FIFO
    ... the FX2's firmware code, would be to install some sort of stub routines ... > how long they are (it appends even for 4 byte long packets). ... > a packet from the FIFO before sending the next one all works fine... ... smaller or larger than what a single buffer could hold. ...
    (comp.arch.embedded)