nando client p3
This commit is contained in:
12
nando
12
nando
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import socket,sys,time,os,configobj
|
||||
|
||||
@@ -90,7 +90,7 @@ def read_desc(opts):
|
||||
return ""
|
||||
|
||||
DESC=open(opts.MSGFILE,"rb").read(1024)
|
||||
DESC=''.join([ c for c in DESC if c not in ['\n','\r','|'] ])
|
||||
DESC=''.join([ str(c) for c in DESC.decode('utf-8') if c not in ['\n','\r','|'] ])
|
||||
return DESC
|
||||
|
||||
opts=setup_options()
|
||||
@@ -115,14 +115,14 @@ while True:
|
||||
else:
|
||||
MSG=opts.command
|
||||
|
||||
sock.sendto(MSG, (opts.HOST, opts.PORT))
|
||||
sock.sendto(MSG.encode('utf8'), (opts.HOST, opts.PORT))
|
||||
received = sock.recv(BLOCK_SIZE)
|
||||
if opts.command!="":
|
||||
print_table(received)
|
||||
print_table(received.decode('utf8'))
|
||||
if opts.INTERVAL==0 and opts.command=="":
|
||||
sock.sendto("list", (opts.HOST, opts.PORT))
|
||||
sock.sendto("list".encode('utf8'), (opts.HOST, opts.PORT))
|
||||
received = sock.recv(BLOCK_SIZE)
|
||||
print_table(received)
|
||||
print_table(received.decode('utf8'))
|
||||
errors=0
|
||||
except socket.error:
|
||||
print("Didn't get reply from {0}:{1}".format(opts.HOST,opts.PORT))
|
||||
|
||||
Reference in New Issue
Block a user