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