More additions

Added code for accepting connection, receiving data and closing sockets.