Sockin.bind(('192.168.10.5',23000)) #socket绑定该主机的ip和端口
while True: #循环中执行收发功能
text = raw_input('> ')
Sockin.sendto(text,(('192.168.10.8',23000))) #将 'text’ 发送给对方
if text == 'q':
Scokin.close() #退出时关闭socket
break
if msg == 'q':
break
print msg
Sockin.bind(('192.168.10.8',23000))
while True:
msg,(addr,port) = Sockin.recvfrom(100)
if msg == 'q':
break
else:
print msg
text = raw_input('> ')
Sockin.sendto(text,(('192.168.10.5',23000)))
if text =='q':
break