#服务端
from
socket import * s=socket(AF_INET,SOCK_STREAM)#IVP4 寻址 tcp协议 s.bind(('',6666))#补丁端口 s.listen(1)#开始监听一个队列 sock,addr=s.accept()#返回两次 第一次返回连接地址 二 端口号 print ('成功',addr)

sock.send(str('dd').encode("utf-8"))
text=sock.recv(1024)#缓存长度 

print (text) sock.close() s.close()
#客户端
from
socket import * s=socket(AF_INET,SOCK_STREAM)#IVP4 寻址 tcp协议 s.connect(('127.0.0.1',6666)) text=s.recv(1024) print (text)
s.send(str('dd').encode("utf-8"))
s.close()

 

相关文章:

  • 2021-07-12
  • 2022-02-28
  • 2022-03-06
  • 2022-12-23
  • 2022-01-16
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-07
  • 2022-12-23
  • 2021-09-08
  • 2022-02-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案