Add null check for receiver socket.
(receiver socket should be terminated?)