socket-多线程并发-client

#!/usr/bin/env python

import socket

import sys

 

HOST,PORT="192.168.2.110",99

sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM)

sock.connect((HOST,PORT))

 

while True:

  data =raw_input('msg to send::').strip()

  if len(data) ==0:continue

 sock.sendall(data+"\n")

  received =sock.recv(1024)

  print"Sent:{}",format(data)

  print"Received:{}",format(received)

sock.close()

~            

 

分割线
感谢打赏
江西数库信息技术有限公司
YWSOS.COM 平台代运维解决方案
 评论
 发表评论
姓   名:

Powered by AKCMS