Index: trunk/absroot/source/abspy/test/tcp/client.py =================================================================== diff --git a/trunk/absroot/source/abspy/test/tcp/client.py b/trunk/absroot/source/abspy/test/tcp/client.py --- a/trunk/absroot/source/abspy/test/tcp/client.py (revision 85) +++ b/trunk/absroot/source/abspy/test/tcp/client.py (revision 86) @@ -1,14 +1,75 @@ -import socket +import socket +import string +#import time -host = "192.168.1.100" -s = socket.socket() +def int2bin(n): + n_hex = "%x" %n + ln = len(n_hex) + if ln == 1: + n_hex = "00000" + n_hex + elif ln == 2: + n_hex = "0000" + n_hex + elif ln == 3: + n_hex = "000" + n_hex + elif ln == 4: + n_hex = "00" + n_hex + elif ln == 5: + n_hex = "0" + n_hex + + byte1 = n_hex[0:2] + byte2 = n_hex[2:4] + byte3 = n_hex[4:6] + str_len = "" + str_len += "%c" % string.atoi(byte1,16) + str_len += "%c" % string.atoi(byte2,16) + str_len += "%c" % string.atoi(byte3,16) + + return str_len + +#ini = time.time() +#sum = 0 + +#for i in range(11,15): +i=117 +#ini1 = time.time() +s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +host = "192.168.1." + str(i) s.connect((host, 5500)) + +fd = open("experimento1.abs","r") +FileList = fd.readlines() +data = "".join(FileList) -fd = open("input3.txt","r") -FileList = fd.readlines() -mensaje = "".join(FileList) -s.send(mensaje) +dfl = 0 +lng = int2bin(dfl) +msg = "jro" + "abs" + "src" + "cm1" + lng + "cmd" + data + "crc" # +print len(msg) +print msg -print "adios" - -s.close() \ No newline at end of file +lmsg = len(msg) +lng = int2bin(lmsg) + +msg = "jro" + "abs" + "src" + "cm1" + lng + "cmd" + data + "crc" # +print len(msg) +print msg + +total_len = len(msg) + 3 + +s.send(mensaje) +#recibido = s.recv(512) + +print recibido + +s.close() + + +# delay = time.time() - ini1 +# sum += delay +# print delay +# time.sleep(0.1) + +#print sum + + + + \ No newline at end of file Index: trunk/absroot/source/abspy/test/tcp/experimento1.abs =================================================================== diff --git a/trunk/absroot/source/abspy/test/tcp/experimento1.abs b/trunk/absroot/source/abspy/test/tcp/experimento1.abs new file mode 10644 --- /dev/null (revision 0) +++ b/trunk/absroot/source/abspy/test/tcp/experimento1.abs (revision 86) @@ -0,0 +1,231 @@ + title ='MST-ISR 2009 (NS-Up)' + + #Experiments = 12 + +1 = + [[0.5,0.5,0.5,0.5,1.5,0.5,0.5,0.5],$ + [2.0,1.0,1.0,1.0,3.0,1.0,1.0,1.0],$ + [0.0,0.5,0.5,0.5,0.0,0.5,0.5,0.5],$ + [3.5,0.5,0.5,0.5,2.5,0.5,0.5,0.5],$ + [1.0,1.0,1.0,1.0,1.0,2.0,3.0,0.0],$ + [0.5,0.5,0.5,1.0,2.0,3.0,0.0,1.0],$ + [1.0,1.0,1.0,1.0,3.0,0.0,1.0,2.0],$ + [0.5,0.5,0.5,0.5,0.0,1.0,2.0,3.0]] + + [[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$ + [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],$ + [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$ + [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$ + [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],$ + [0.5,0.5,0.5,1.0,1.0,1.0,1.0,1.0],$ + [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],$ + [0.5,0.5,0.5,0.5,1.0,1.0,1.0,1.0]] + +2 = + [[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$ + [1.0,1.0,1.0,0.0,1.0,1.0,1.0,1.0],$ + [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$ + [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$ + [1.0,1.0,1.0,1.0,2.0,3.0,0.0,1.0],$ + [0.5,0.5,0.5,1.0,3.0,0.0,1.0,2.0],$ + [1.0,1.0,1.0,1.0,0.0,1.0,2.0,3.0],$ + [0.5,0.5,0.5,0.5,1.0,2.0,3.0,0.0]] + + [[0.5,0.5,0.5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0],$ + [0.5,0.5,0.5,1.0,3.0,3.0,3.0,3.0],$ + [1.0,1.0,1.0,1.0,3.0,3.0,3.0,3.0],$ + [0.5,0.5,0.5,0.5,3.0,3.0,3.0,3.0]] + + [[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$ + [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],$ + [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$ + [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$ + [1.0,1.0,1.0,1.0,3.0,3.0,3.0,3.0],$ + [0.5,0.5,0.5,1.0,3.0,3.0,3.0,3.0],$ + [1.0,1.0,1.0,1.0,3.0,3.0,3.0,3.0],$ + [0.5,0.5,0.5,0.5,3.0,3.0,3.0,3.0]] + +12 = + [[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$ + [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],$ + [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$ + [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$ + [1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0],$ + [0.5,0.5,0.5,1.0,0.0,0.0,0.0,0.0],$ + [1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0],$ + [0.5,0.5,0.5,0.5,0.0,0.0,0.0,0.0]] + + [[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$ + [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],$ + [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$ + [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$ + [1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0],$ + [0.5,0.5,0.5,1.0,0.0,0.0,0.0,0.0],$ + [1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0],$ + [0.5,0.5,0.5,0.5,0.0,0.0,0.0,0.0]] Index: trunk/absroot/source/abspy/test/tcp/server.py =================================================================== diff --git a/trunk/absroot/source/abspy/test/tcp/server.py b/trunk/absroot/source/abspy/test/tcp/server.py --- a/trunk/absroot/source/abspy/test/tcp/server.py (revision 85) +++ b/trunk/absroot/source/abspy/test/tcp/server.py (revision 86) @@ -1,7 +1,7 @@ import socket import time -host = "192.168.1.100" +host = "192.168.1.117" s = socket.socket() s.bind((host, 5500)) @@ -12,11 +12,24 @@ sc, addr = s.accept() all = "" +# while True: +# recibido = sc.recv(1024) +# all = all + recibido +# if all[-4:] == "quit": +# break + cnt = 0; while True: recibido = sc.recv(1024) - all = all + recibido - if all[-4:] == "quit": + if len(recibido) == 1024: + all = all + recibido + else: + all = recibido + + cnt = cnt + len(all) + if cnt == 1024: break + + print "\nTotal:", all print "\nLongitud:", len(all)