Home > other >  I use python for simple chat QQ simulation, the results have no connection, how this ah
I use python for simple chat QQ simulation, the results have no connection, how this ah

Time:03-26

From the socket import *
Client_socket=socket (AF_INET SOCK_STREAM)
Client_socket. Connect ((8888) "192.168.121.1)
While True:
# the client sends the message
MSG=input (" & gt;>" )
Client_socket. Send (MSG) encode (" utf-8 "))
# the client receives the message
rece_data=https://bbs.csdn.net/topics/client_socket.recv (1024)
Print (" the service side said: ", rece_data decode (" utf-8 "))

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

From the socket import *
Server_socket=socket (AF_INET SOCK_STREAM)
Server_socket. Bind ((8888), "")
Server_socket. Listen ()
Client_socket, client_info=server_socket. The accept ()
While True:
# server receives the message
Recv_data=https://bbs.csdn.net/topics/client_socket.recv (1024)
Print (" client, "said, recv_data decode (" utf-8"))
# server sends the message
MSG=input (" & gt;>" )
Client_socket. Send (MSG) encode (" utf-8 "))
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
My aunt no problem, all is according to knock out in the video, but that is not Shared, two programs here to play in the past, receiving less than, there does not display,
  • Related