add timeout for socket operations