handle message arriving when sockets are closed
handle message arriving when sockets are closed

check both the incoming and outgoing streams
before proceeding to send messages
ipython/ipython,ipython/ipython