I have a Linux TCP server using the epoll mechanism. Multiple threads are running which may send data to any given connected socket/client at any given time. My question arises from the scenario of two threads sending messages to the same socket at the same time via ::send().
Would the resultant messages be sent sequentially or mixed/merged?
The documentation for send() on the Linux manual pages only mention occurance of errors if the message is too long to be atomically sent. There is no confirmation that the sending is atomic. However if so, this scenario is not an issue because the messages would be sent sequentially, right?
Example
Two messages could be:
- "HelloThere"
- "Ciao"
Sequential Expectation
Received: "HelloThereCiao"
Merged Expectation
Recieved: "HelloCiaoThere" or some vast combination of this.