Added changes sent by Dany. Functional code for a connection to the server.