net.Socket's timeout can be reset or doesn't work on some cases. Implemented a custom timeout.