Handle error cases 'tcp connection fails' and 'connection to serial device breaks'. Also make sure a thread can send signal that kills whole process