Updated networking to use NIO

Code is now embedded in the message.