yoWeb simple client for debug

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import sys
from socket import *
from threading import *
class Recever(Thread):
def run(self):
self.__finish=0
while not self.__finish:
dat=s.recv(1024)
if dat:
print '\t -> ', dat
def stop(self):
self.__finish=1
addr = ('localhost', 1222)
global s
s=socket(AF_INET, SOCK_DGRAM)
s.sendto('/regme', addr)
demon=Recever()
demon.start()
while 1:
try:
data=raw_input('')
s.sendto(data, addr)
except KeyboardInterrupt:
s.sendto('bye-bye', addr)
demon.stop()
s.close()
sys.exit(1)