Changed Server and Client to use 'close' followed by 'shutdown', since close seems to close a connection clearly, while shutdown guarantees a closed connection.