It's a small server (http) so I don't wait for any reply from the client. If there's an header "connection: close", server should close connection when data is sent.
So on server side i should write: if (httpRequest.isCompleted) { // Parsing request headers [... omitted ...] // Build http reply [... omitted ...] socket.send(reply); socket.shutdown(SocketShutdown.BOTH); } and then wait for client to close connection?