added threaded send and receive functionality, does however hang on exit due to sockets not being closed
listen thread no longer hangs on exit