python - send one big packet of many small over TCP/UDP? -
i sending coordinates of points visualizational client-side script via tcp on internet. wonder option should use:
- concat coordinates large string , send them together, or
- send them 1 one
i don't know 1 faster is. have other questions too:
- which 1 should use?
- is there maximum size of packet of tcp? (python: maximum size of
stringclient.send(string)) - as visualization project should use udp instead of tcp?
- could please tell me bit lost packet? when occur? how deal them?
sorry many questions, struggle issue...
when send string, might sent in multiple tcp packets. if send multiple strings, might sent in 1 tcp packet. not exposed packets, tcp sockets constant stream of data. not expect every call recv() paired single call send(), because isn't true. might send "abcd" , "efg", , might read in "a", "bcde", , "fg" recv().
it best send data it, networking stack has information you're sending, possible. decide do. can send big string like, , if necessary, broken send on wire. automatically.
since in tcp don't deal packets, things lost packets aren't concern. that's handled automatically -- either data gets through eventually, or connection closes.
as udp - don't want udp. :)
Comments
Post a Comment