Original Post
🔒 Locked
send() 2 different threads same socket, safe?
Advertisement
If you use blocking sockets, it is not very safe, and you should use a critical section around the code, so one thread isn't locked inside a send and the other comes and wants to send something. If you're using async sockets, you can probably get away with it, but that will probably be senseless to do, as you won't have control of the order the data will be sent, and the receiver don't know what it is getting. Either way, use some sort of control mechanism; critcal sections for blocking, or some bool indicating if the socket is "free" when using async.
EDIT: As for what will happen. I do think there is a socket error for "socket busy", which is likely that you'll see if you try it.
---------------------------------------------
"VB is a disease"
[edited by - CWizard on October 26, 2002 9:32:58 PM]
EDIT: As for what will happen. I do think there is a socket error for "socket busy", which is likely that you'll see if you try it.
---------------------------------------------
"VB is a disease"
[edited by - CWizard on October 26, 2002 9:32:58 PM]
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement