I want to implement a while-loop that runs as long as a Client is connected at my socket.
It’s gonna be Thread based so i want to make shure that the Thread gets closed once the Client disconnected.
-
question: How do I check if the Client is still connected to my socket?
-
question: Is the Thread already getting closed when connection closes if I startet it like this: Thread.start(socket.accept) do |client| …
I don’t have experience programming ruby. If it was .Net, what you pretend is not possible without some kind of keep-alive protocol. If the server does not get data from client after x seconds it assumes the client disconnected. The client must have a timer to send something to the server when not communicating.