__connect_no_cancel blocks and server gets data out of order
I have a TCP server using select to get data from a client through TCP socket. The Server is slow in consuming data while the client is much faster. My client sends 8 bytes of data and each time it -open a new connection -write data -disconnect Because of this ( the server socket must accept many connection ) I increased the backlock value of listen to 500.
Despite this setting, at some point I can see that -my client blocks in a pthread function called __connect_nocancel and this happens many times. -after a while my server starts receiving data out of orders. The first data messed up is the one where the client blocks ( followed by other ).
I thought that increasing the backlog may fix this but this issue but this is not the case.
Can You help me? I am in Linux 2.6.32
The backlog parameter of listen(2) is usually capped to some value inside the OS network stack. On Linux the default is 128.
The real problem though is, as @EJP is saying, you are totally mis-using TCP.