##// END OF EJS Templates
Modificaciones en servidor tcp para evitar perdida de datos en funcion recv
imanay -
r65:66
parent child
Show More
@@ -4,19 +4,22
4 4 host = "192.168.1.117"
5 5 s = socket.socket()
6 6 s.bind((host, 5500))
7 print "waiting client..."
7 8 s.listen(1)
8 9
9 sc, addr = s.accept()
10
10 sc, addr = s.accept()
11 all = ""
12
11 13 while True:
12 recibido = sc.recv(1024)
13 time.sleep(70)
14 if recibido == "quit":
15 break
16 print "Recibido:", recibido
17 sc.send(recibido)
18
19 print "adios"
20
14 recibido = sc.recv(1024)
15 all = all + recibido
16 if all[-4:] == "quit":
17 break
18
19 print "\nTotal:", all
20 print "\nLongitud:", len(all)
21
21 22 sc.close()
22 s.close() No newline at end of file
23 s.close()
24
25 #print len(recibido) No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now