Use try/except in receive thread.