#!/usr/bin/python
#!--coding:utf-8--
import socket
import sys
import time
import threading
def so(HOST,PORT,NAME):
try:
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect((HOST,PORT))
s.settimeout(5)
while True:
data=s.recv(1024)
print '%s--%s' %(NAME,time.strftime('%Y-%m-%d %X'))
time.sleep(0.01)
s.close()
except Exception,e:
print e
t=threading.Thread(target=so,args=('127.0.0.1',27610,'JT808'))
t1=threading.Thread(target=so,args=('127.0.0.1',5000,'alarmdealwith'))
t2=threading.Thread(target=so,args=('127.0.0.1',11584,'Unisummery'))
t.start()
t1.start()
t2.start()
t.join()
t1.join()
t2.join()
阅读(3901) | 评论(0) | 转发(0) |