Socket hangs in recv randomly


New Member
Apr 20, 2022
Reaction score
I have set up a network with a Linux host communicating over TCP/IP with a standard Windows computer. There is a strange behavior occurring sporadically and maybe you have an idea where this might come from.

On Linux side there has been a standard TCP socket created which listens for an incoming connection from the Windows system.
Messages can be transferred normally, but sometimes (randomly) I can observe, that no more messages are received on Linux side. A separate socket which sends data to Windows works, so I would exclude the Windows part and also Ethernet cabling (no routers/switches in between both systems). I need to power down the Linux host to reconnect again.

It seems that Linux socket sporadically hangs somewhere in this blocking recv() function. I have also tried it with UDP communication, but same random behavior there.

What program is it that is causing the hang? Do you have any source code for it?
If this is your own code, perhaps there is a bug in the code somewhere?!
Have you tried running it in a debugger?!
I'd also want to know which version of Linux we're talking about.
it's already an older Linux Kernel version 3.17. Probably you are right, there must be a bug somewhere in the communication level, either on my side or somewhere lower.
Debugging is hard since I cannot estimate when this issue happens.

Members online

Latest posts