sockets.d: more error handling