Realize socket communication with server