Update client.d

Moved socket operations out to their own functions where they should have been from the beginning. Changed "127.0.0.1" to "localhost" to make DCD work on certain Windows configurations.