changes to socket.py as per latest communication protocol