Added socket functions and test client.