Threaded client and server implementation.
Fixed compiler errors/warnings.