mercredi 25 février 2015

Can I call socket send() from different threads?

If I have a socket called s, can I do this in different threads:


Thread 1:



send(s, "Hello from Thread 1");


Thread 2:



send(s, "Hello from Thread 2");


Is it guaranteed that these two strings will be placed in the send buffer one after the other (I don't care which one is placed first), or is there a possibility that they could get mixed together?


Note: maybe this question should have been titled: "Is socket send() thread safe" (but I am not really sure what thread safety means).


Aucun commentaire:

Enregistrer un commentaire