@@ -115,10 +115,16 | |||||
115 | def waitAsClient(self, nbytes = 1024): |
|
115 | def waitAsClient(self, nbytes = 1024): | |
116 | print "\nWaiting the server." |
|
116 | print "\nWaiting the server." | |
117 | # Short data through ethernet |
|
117 | # Short data through ethernet | |
118 | trama_rx = self.socket_c.recv(nbytes) |
|
118 | try: | |
119 | lng = int(trama_rx[20:26]) |
|
119 | trama_rx = self.socket_c.recv(nbytes) | |
120 | print "\nThis socket has received this data: " + str(trama_rx) |
|
120 | lng = int(trama_rx[20:26]) | |
121 |
|
121 | except: | ||
|
122 | print "Waiting error" | |||
|
123 | trama_rx = "Error" | |||
|
124 | lng = 0 | |||
|
125 | else: | |||
|
126 | print "\nThis socket has received this data: " + str(trama_rx) | |||
|
127 | ||||
122 | return trama_rx, lng |
|
128 | return trama_rx, lng | |
123 |
|
129 | |||
124 | def sendData2(self, cmd, data, ipDestino): |
|
130 | def sendData2(self, cmd, data, ipDestino): | |
@@ -153,10 +159,14 | |||||
153 |
|
159 | |||
154 |
|
160 | |||
155 | def SendAsClient(self, ipDestino, trama_tx): |
|
161 | def SendAsClient(self, ipDestino, trama_tx): | |
156 |
|
162 | |||
157 | self.socket_c.connect((ipDestino, self.portDestino)) |
|
163 | try: | |
158 | self.socket_c.send(trama_tx) |
|
164 | self.socket_c.connect((ipDestino, self.portDestino)) | |
159 | print "Sending message:[" + trama_tx + "] to: " + ipDestino |
|
165 | except: | |
|
166 | print "Connection error with:" + ipDestino | |||
|
167 | else: | |||
|
168 | self.socket_c.send(trama_tx) | |||
|
169 | print "Sending message:[" + trama_tx + "] to: " + ipDestino | |||
160 |
|
170 | |||
161 | def __getTrama2(self, trama): |
|
171 | def __getTrama2(self, trama): | |
162 |
|
172 |
@@ -1,8 +1,8 | |||||
1 | import file |
|
1 | import file | |
2 | from client3 import * |
|
2 | from client3 import * | |
3 |
|
3 | |||
4 |
|
|
4 | opt = "0" | |
5 |
|
5 | |||
6 | absObj = ABSClient(ipDestino="10.10.10.97") |
|
6 | absObj = ABSClient(ipDestino="10.10.10.97") | |
7 | #absObj = ABSClient() |
|
7 | #absObj = ABSClient() | |
8 |
absObj.getControlModulePhase( |
|
8 | absObj.getControlModulePhase(opt) No newline at end of file |
@@ -11,7 +11,7 | |||||
11 | 192.168.1.9 [0 0] |
|
11 | 192.168.1.9 [0 0] | |
12 | 192.168.1.10 [0 0] |
|
12 | 192.168.1.10 [0 0] | |
13 | 192.168.1.11 [0 0] |
|
13 | 192.168.1.11 [0 0] | |
14 |
192.168.1.12 [ |
|
14 | 192.168.1.12 [1 1] | |
15 | 192.168.1.13 [0 0] |
|
15 | 192.168.1.13 [0 0] | |
16 | 192.168.1.14 [0 0] |
|
16 | 192.168.1.14 [0 0] | |
17 | 192.168.1.15 [0 0] |
|
17 | 192.168.1.15 [0 0] |
General Comments 0
You need to be logged in to leave comments.
Login now