# -- coding: utf-8 --

import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

# 建立连接
s.connect(('1172.16.31.10', 8899))

# 接收消息
wel = s.recv(1024).decode('utf-8')
print(wel)

# 发送消息
for data in (b'Michael', b'Tracy', b'Sarah'):
    s.send(data)
    back = s.recv(1024).decode('utf-8')
    print(back)
s.send(b'exit')
s.close()


# -- coding: utf-8 --

import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

# 建立连接
s.connect(('1172.16.31.10', 8899))

# 接收消息
wel = s.recv(1024).decode('utf-8')
print(wel)

# 发送消息
for data in (b'Michael', b'Tracy', b'Sarah'):
    s.send(data)
    back = s.recv(1024).decode('utf-8')
    print(back)
s.send(b'exit')
s.close()


# -- coding: utf-8 -- # 建立连接 # 接收消息 # 发送消息