Is it legal to accept and read from TCP socket in one thread and write data in same socket in another thread on Linux?
Example:
// thread #1
// ...
int sock = accept(server_fd, (struct sockaddr*)&address, (socklen_t*)&addrlen));
// .. read from socket sock
#thread #2
// ...
int n = send(sock, buffer, 1024);
// ...
it is legal or undefined behaviour?