import socket
import time
while True:
server=socket.socket()
server.bind(('127.0.0.1',6969))#綁定監(jiān)聽的對象
server.listen()#監(jiān)聽客戶端是否接收
print("準備接電話")
con,addr=server.accept()#接收客戶端的消息,兩個con和addr
print("con是:",con)
print("addr是:",addr)
data=con.recv(1024)#默認一次接收1024字節(jié)的數(shù)據(jù)
print("接收的消息是:",data)
time.sleep(1)