##// END OF EJS Templates
imanay -
r69:70
parent child
Show More
@@ -1,10 +1,10
1 import socket
1 import socket
2
2
3 host = "192.168.1.117"
3 host = "192.168.1.100"
4 s = socket.socket()
4 s = socket.socket()
5 s.connect((host, 5500))
5 s.connect((host, 5500))
6
6
7 fd = open("input.txt","r")
7 fd = open("input3.txt","r")
8 FileList = fd.readlines()
8 FileList = fd.readlines()
9 mensaje = "".join(FileList)
9 mensaje = "".join(FileList)
10 s.send(mensaje)
10 s.send(mensaje)
@@ -1,6 +1,6
1 n = 16384 + 1
1 n = 511 + 1
2 #n = 32768 + 1
2 #n = 32768 + 1
3 fd = open("input2.txt","w")
3 fd = open("input3.txt","w")
4 for i in range(n):
4 for i in range(n):
5 fd.write("@")
5 fd.write("@")
6 fd.write("quit")
6 fd.write("quit")
@@ -1,23 +1,25
1 import socket
1 import socket
2 import time
2 import time
3
3
4 host = "192.168.1.117"
4 host = "192.168.1.100"
5 s = socket.socket()
5 s = socket.socket()
6 s.bind((host, 5500))
6 s.bind((host, 5500))
7 print "waiting client..."
7
8 s.listen(1)
8 while True:
9 print "waiting client..."
10 s.listen(1)
9
11
10 sc, addr = s.accept()
12 sc, addr = s.accept()
11 all = ""
12
13 while True:
14 recibido = sc.recv(1024)
15 all = all + recibido
16 if all[-4:] == "quit":
17 break
18
13
19 print "\nTotal:", all
14 all = ""
20 print "\nLongitud:", len(all)
15 while True:
16 recibido = sc.recv(1024)
17 all = all + recibido
18 if all[-4:] == "quit":
19 break
20
21 print "\nTotal:", all
22 print "\nLongitud:", len(all)
21
23
22 sc.close()
24 sc.close()
23 s.close()
25 s.close()
General Comments 0
You need to be logged in to leave comments. Login now