I have several potions sent to a shared socket. Is it guaranteed that every packet sent through socket.sendall is well separated or do I need to get a lock before every call to sendall .
Therefore, I want to prevent the following scenario:
- g1 sends
ABCD - g2 sends
1234 - the received data is mixed, for example
AB1234CD - expected to be either
ABCD1234 or 1234ABCD
Update
Looking at the source code , I think that this scenario cannot be. But I have to use a lock because g1 or g2 may crash on sendall . Can someone confirm this?
source share