I don't think it's because of this, since handshaking/connection-establishment is working fine. What is happening is that at some point zm calls recv but the connection has been dropped, most probably by your router. You might log the network traffic with tcpdump for the stratum ports you're connecting to and pm them to me, I'll take a look if I can find something. You could also check kernels tcp keepalive settings in /proc/sys/net/ipv4/tcp_keepalive_..... . they might help with nat-routers.