Added timeout to socket reads and writes for sender.c