Socket stream lost handling

When dealing with long running PHP background jobs, the situation can occur that the socket is not available or an error occured on the socket. The socket instance does not disconnect in such events, either the Client does not check if the socket is still connected.