updated socket read write to nonblocking to allow for ssl.