modify the socket function