通过tcp实现字符大写转换的python客户端代码,
服务端代码参考:http://www.75271.com/codes/python/8081
import socket import netstring s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(('127.0.0.1', 8081)) while 1: arg = raw_input("Send: ") if not arg: netstring.writens(s, "end") break netstring.writens(s, arg) ret = netstring.readns(s) print "Returned:", ret s.close()