@@ -32,19 +32,15 | |||
|
32 | 32 | data = FileStr No newline at end of file |
|
33 | 33 | No newline at end of file |
|
34 | 34 |
self.commObj.open_socket() |
|
35 | No newline at end of file | |
|
35 | # self.commObj.sendData(cmd="SNDF", data=data, id = 117) | |
|
No newline at end of file | ||
|
36 | No newline at end of file | |
|
36 | self.commObj.sendData2(cmd="SNDF", data=data, ipDestino = self.ipDestino) | |
|
No newline at end of file | ||
|
37 | # self.commObj.waitData() | |
|
No newline at end of file | ||
|
38 | self.commObj.waitClient() No newline at end of file | |
|
39 | 37 | self.commObj.close_socket() No newline at end of file |
|
40 | 38 | No newline at end of file |
|
41 | 39 | def changeBeam(self, newBeam): No newline at end of file |
|
42 | 40 | No newline at end of file |
|
43 | 41 | self.commObj.open_socket() |
|
42 | No newline at end of file | |
|
44 | # self.commObj.sendData(cmd="CHGB", data=newBeam, id = 117) | |
|
No newline at end of file | ||
|
43 | No newline at end of file | |
|
45 | self.commObj.sendData2(cmd="CHGB", data=newBeam, ipDestino = self.ipDestino) | |
|
No newline at end of file | ||
|
46 | # self.commObj.waitData() | |
|
No newline at end of file | ||
|
47 | self.commObj.waitClient() No newline at end of file | |
|
48 | 44 | self.commObj.close_socket() No newline at end of file |
|
49 | 45 | No newline at end of file |
|
50 | 46 | def __writeFile(self, filename, data): No newline at end of file |
@@ -45,34 +45,17 | |||
|
45 | 45 | # No newline at end of file |
|
46 | 46 | # self.socket_c.bind(self.addr) No newline at end of file |
|
47 | 47 | |
|
48 | No newline at end of file | |
|
48 | def waitData(self, nbytes = 1024): | |
|
No newline at end of file | ||
|
49 | No newline at end of file | |
|
49 | ||
|
No newline at end of file | ||
|
50 | No newline at end of file | |
|
50 | print "\nWaiting some client." | |
|
No newline at end of file | ||
|
51 | ||
|
No newline at end of file | ||
|
52 | if self.asServer == False: | |
|
No newline at end of file | ||
|
53 | # Short data through ethernet | |
|
No newline at end of file | ||
|
54 | trama_rx = self.socket_c.recv(nbytes) No newline at end of file | |
|
55 | 51 | else: |
|
52 | No newline at end of file | |
|
56 | self.socket_c.listen(1) | |
|
No newline at end of file | ||
|
57 | sc, addr = self.socket_c.accept() | |
|
No newline at end of file | ||
|
58 | self.sc = sc | |
|
No newline at end of file | ||
|
59 | self.answer = addr | |
|
No newline at end of file | ||
|
60 | # Big data through ethernet | |
|
No newline at end of file | ||
|
61 | trama_rx = "" | |
|
No newline at end of file | ||
|
62 | while True: | |
|
No newline at end of file | ||
|
63 | tmp = self.sc.recv(nbytes) | |
|
No newline at end of file | ||
|
64 | trama_rx = trama_rx + tmp | |
|
No newline at end of file | ||
|
65 | if trama_rx[-4:] == "quit": | |
|
No newline at end of file | ||
|
66 | break | |
|
No newline at end of file | ||
|
67 | ||
|
No newline at end of file | ||
|
68 | print "\nThis socket has received some data." No newline at end of file | |
|
69 | 53 | No newline at end of file |
|
70 | 54 | ipSource, ipDestino, cmd, data = self.__getTrama(trama_rx) No newline at end of file |
|
71 | 55 | No newline at end of file |
|
72 | 56 | return ipSource, ipDestino, cmd, data No newline at end of file |
|
73 | 57 | |
|
58 | No newline at end of file | |
|
74 | def waitServer(self, nbytes = 1024): | |
|
No newline at end of file | ||
|
75 | No newline at end of file | |
|
76 | 59 | print "\nWaiting some client." No newline at end of file |
|
77 | 60 | self.socket_c.listen(1) No newline at end of file |
|
78 | 61 | sc, addr = self.socket_c.accept() No newline at end of file |
@@ -28,7 +28,7 | |||
|
28 | 28 | def waitRequest(self): No newline at end of file |
|
29 | 29 | No newline at end of file |
|
30 | 30 | #Using rx buffer |
|
31 | No newline at end of file | |
|
31 | ipSource, ipDestino, cmd, self.rx_buffer = self.commServerObj.waitServer() No newline at end of file | |
|
32 | 32 | No newline at end of file |
|
33 | 33 | if cmd == "SNDF": No newline at end of file |
|
34 | 34 | datarpta = self.__sendFile2Modules(cmd = cmd) No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now