tcp client --test

#!/usr/bin/env python
# -*-coding:UTF-8 -*-
import socket
import time
import re
import sys
SERVER='127.0.0.1'
PORT=8888
c=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
try:
    c.connect((SERVER,PORT))
except:
    sys.exit("连接服务器失败")
while True:
    sstr=raw_input("what do you send:")
    c.send(sstr)
    if sstr=="/quit":
        c.close()
        break