socket编程-服务器端

import socket

server = socket.socket()

server.bind(('127.0.0.1',9999))

server.listen()

s, raddr = server.accept()

while True:
    data = s.recv(1024)
    print(data)
    s.send('ack. {}'.format(data.decode()).encode())

s.close()
server.close()

 https://www.bilibili.com/video/av33619067?p=3

posted @ 2019-04-01 17:21  ACPIE  阅读(190)  评论(0编辑  收藏  举报