I am trying to write some data in the socket after specific time interval. I have two threads, one thread maintaining the TCP connection, and another thread generating data.
The data generating therad generates data, and writes it to a shared memory. The server threadreads data from the shared memory, and sends it to the client.
But, when the data generating thread becomes slow, when a lot of calculations involved, the server thread gets a EWOULDBLOCK error when trying to write to the client. But, surprisingly, from the client side, there is no such error.
If I am not wrong, EWOULDBLOCK error is returned when server is faster than client and the socket buffer is not completely read before it gets written again. But, here the case is totally opposite.
Can it be because the server therad is kept on sleep till the data generation thread completes( data thread has a higher priority).
Can somebody explain what might be happening here?