##// END OF EJS Templates
Trying frame without semicolon.
Trying frame without semicolon.

File last commit:

r91:92
r101:102
Show More
server.py
39 lines | 791 B | text/x-python | PythonLexer
r59 import socket
import time
r53
r85 host = "192.168.1.117"
r52 s = socket.socket()
r53 s.bind((host, 5500))
r69
while True:
print "waiting client..."
s.listen(1)
r52
r69 sc, addr = s.accept()
Modificaciones en servidor tcp para evitar perdida de datos en funcion recv
r65
r69 all = ""
Testing frame transfer without colon.
r91
# i=0 #to avoid infinit loop
r85 cnt = 0;
Testing frame transfer without colon.
r91 first = 0;
r69 while True:
recibido = sc.recv(1024)
Testing frame transfer without colon.
r91 all = all + recibido
cnt = len(all)
if first == 0:
first = 1;
lng = int(all[12:18]) # 6 bytes to get the frame size
# i = i + 1
# if cnt == lng or i == 30:
if cnt == lng:
r69 break
r85
Testing frame transfer without colon.
r91 print "\nSize of frame:" + str(lng)
print "\nNumber of bytes received:" + str(cnt)
Modificaciones en servidor tcp para evitar perdida de datos en funcion recv
r65
r52 sc.close()
Modificaciones en servidor tcp para evitar perdida de datos en funcion recv
r65 s.close()
#print len(recibido)