Hi,
I am working on a c++ project involving sockets and threads and I need
to ask a pretty basic question.
If you have a socket that every time it accepts a connection
(accept()) it spawns a thread with the identifier returned by accept
where the thread will write to the identifier using send().
My question is, are those identifiers returned by accept unique and
reliable enough s.t I can write (using send()) to them simultaneously
OR do I need a mutex on the writing code so that I don`t write to the
same physical socket by different sockets at the same time?
The current problem is that on the client side, I expect data like 123
and abc (for 2 different clients) and I am getting 1b3 and a2c, sort
of mixed data so that prompted me to ask this question.
Thanks.