Fix issue with hung socket.

For some reason the socket hangs randomly if the request is done using more than one sockwrite command.