It is definitely possible to have sockets die without notice, such that the while loop won't exit. I suffered that when I wrote a telnet-based multiplayer market trading game.

What I did was to select from the current connections, and carefully read a byte at a time.Once there is enough to act on, I call whatever functions need calling. (If not, buffer the input so far, and loop back to the select)

If one of the connections dies silently and unexpectedly, the select won't pick it to read from since there is no more input to read. After a few minutes of no activity, the dead/timed-out connections can be closed.

If the connection is via a WAN or the Internet, then what you are describing can occur. Within a local network, it is much less likely. This is a TCP socket. When either side receives a FIN, the result in the application is an EOF. When a process dies, in almost all instances, open sockets are closed by the OS, resulting in a FIN going to the remote side. On a LAN, the receipt of this is almost certain. On a WAN, intervening equipment/hops can cause packet or session loss.

If the client disconnects, then the while loop should terminate, because the next read will be an EOF. This code segment is obviously incomplete, and requires Oracle to execute. What happens if the client sends only a partial, or mal-constructed request? I would either add debug statements, or run in debug mode, to ensure it is hanging where you think it is hanging. Also, be sure to use

Went to join the gridlock to see it
Held an eclipse party
Watched a live feed
I cn"t see tge kwubosd to amswr thus
I tried to see it, but 8000 miles of rock got in the way
What eclipse?
Wanted to see it, but they wouldn't reschedule it
Read the book instead