On Tue, Jun 29, 2021 at 5:24 PM LetGo <non3co...@gmail.com> wrote: > 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: > > Beware! This is an assumption that will break at some point in time. Currently the delay and the OS makes things straightforward for you. But TCP doesn't behave like you expect, and you are very likely to run into trouble if the machine, the network, or the system starts taking additional load.
You need to frame the data. A good way is to use 4 bytes as a size (unsigned 32 bit integer), followed by a payload of that size. You can then avoid this becoming an uncontrolled explosion in your software at a later date. You can also close connections early if too large messages get sent, etc. -- 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/CAGrdgiXc%2BPHcvRg0xfOQn8Sp2grKr3Gbyb5q2FCys5EKuZesXg%40mail.gmail.com.