[Please do not send images of text; copy and paste as text into the message or into text attachments.]
* LetGo <non3co...@gmail.com> [210629 11:25]: > Thanks for the answer! (: > In python it was straightforward to implement and it works like a charm. It > sends small packets with delay between each other without even care if it > is UDP or TCP: > > [image: prooff.png] > [image: proof2.png] [snip] > Il giorno martedÄ› 29 giugno 2021 alle 14:22:32 UTC+2 Brian Candler ha > scritto: > > > What sort of socket - TCP or UDP? TCP is an infinite stream, and there is > > no reliable way to divide it into "chunks" (except possibly using the URG > > pointer, which is very rarely used). There is no guarantee that waiting > > 1.6 seconds between sends will actually send in separate segments being > > sent, nor that the receiver will be able to determine that these were > > separate segments - they may well be merged. > > > > To do it reliably, you'd want to add your own framing, e.g. send an 4-byte > > length followed by that number of bytes. What Brian is saying is that TCP, by definition, is not required to use the same packets across the wire that you send out. Packets in a TCP stream _may_ be regrouped, both by being split into smaller packets and by being joined into larger packets. They are reassembled at the receiving end of the TCP stream as a stream, not as individual packets. It is very feasible for the receiving end to see packets with exactly the contents of the individual "send" function calls when under normal load, but see something completely different when CPU, network, or memory pressure is applied to the sending system. ...Marvin -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/YNtNDRa837lmx5lz%40basil.wdw.