Reinstate multithreading, change order of instantiating client and server.
Add receive function for client.