increase transfer size.. 1kb hits quickly
This commit is contained in:
11
nando
11
nando
@@ -3,6 +3,7 @@
|
|||||||
import socket,sys,time,os,configobj
|
import socket,sys,time,os,configobj
|
||||||
|
|
||||||
RC="/etc/nandorc"
|
RC="/etc/nandorc"
|
||||||
|
BLOCK_SIZE=10240
|
||||||
|
|
||||||
def setup_options():
|
def setup_options():
|
||||||
''' Setup the command line options '''
|
''' Setup the command line options '''
|
||||||
@@ -63,7 +64,7 @@ def print_table(data):
|
|||||||
|
|
||||||
def query_ip(sock,opts):
|
def query_ip(sock,opts):
|
||||||
sock.sendto("list", (opts.HOST, opts.PORT))
|
sock.sendto("list", (opts.HOST, opts.PORT))
|
||||||
received = sock.recv(1024)
|
received = sock.recv(BLOCK_SIZE)
|
||||||
for row in received.split("\n"):
|
for row in received.split("\n"):
|
||||||
cols=row.split("|",4)
|
cols=row.split("|",4)
|
||||||
if cols[0]==opts.QUERY_HOSTNAME:
|
if cols[0]==opts.QUERY_HOSTNAME:
|
||||||
@@ -73,7 +74,7 @@ def query_ip(sock,opts):
|
|||||||
|
|
||||||
def query_host(sock,opts):
|
def query_host(sock,opts):
|
||||||
sock.sendto("list", (opts.HOST, opts.PORT))
|
sock.sendto("list", (opts.HOST, opts.PORT))
|
||||||
received = sock.recv(1024)
|
received = sock.recv(BLOCK_SIZE)
|
||||||
for row in received.split("\n"):
|
for row in received.split("\n"):
|
||||||
cols=row.split("|",4)
|
cols=row.split("|",4)
|
||||||
if cols[1]==opts.QUERY_IP:
|
if cols[1]==opts.QUERY_IP:
|
||||||
@@ -88,7 +89,7 @@ def read_desc(opts):
|
|||||||
if not os.path.isfile(opts.MSGFILE):
|
if not os.path.isfile(opts.MSGFILE):
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
DESC=open(opts.MSGFILE,"rb").read(512)
|
DESC=open(opts.MSGFILE,"rb").read(1024)
|
||||||
DESC=''.join([ c for c in DESC if c not in ['\n','\r','|'] ])
|
DESC=''.join([ c for c in DESC if c not in ['\n','\r','|'] ])
|
||||||
return DESC
|
return DESC
|
||||||
|
|
||||||
@@ -115,12 +116,12 @@ while True:
|
|||||||
MSG=opts.command
|
MSG=opts.command
|
||||||
|
|
||||||
sock.sendto(MSG, (opts.HOST, opts.PORT))
|
sock.sendto(MSG, (opts.HOST, opts.PORT))
|
||||||
received = sock.recv(1024)
|
received = sock.recv(BLOCK_SIZE)
|
||||||
if opts.command!="":
|
if opts.command!="":
|
||||||
print_table(received)
|
print_table(received)
|
||||||
if opts.INTERVAL==0 and opts.command=="":
|
if opts.INTERVAL==0 and opts.command=="":
|
||||||
sock.sendto("list", (opts.HOST, opts.PORT))
|
sock.sendto("list", (opts.HOST, opts.PORT))
|
||||||
received = sock.recv(1024)
|
received = sock.recv(BLOCK_SIZE)
|
||||||
print_table(received)
|
print_table(received)
|
||||||
errors=0
|
errors=0
|
||||||
except socket.error:
|
except socket.error:
|
||||||
|
|||||||
Reference in New Issue
Block a user