@@ -8,7 +8,7 | |||
|
8 | 8 | |
|
9 | 9 | class ABSClient: |
|
10 | 10 | |
|
11 |
def __init__(self,ipSource="localhost", ipDestino="192.168.1.1 |
|
|
11 | def __init__(self,ipSource="localhost", ipDestino="192.168.1.117", portDestino=7000): | |
|
12 | 12 | |
|
13 | 13 | self.ipSource = ipSource |
|
14 | 14 | self.ipDestino = ipDestino |
@@ -33,11 +33,13 | |||
|
33 | 33 | |
|
34 | 34 | self.commObj.sendData(cmd="SNDF", data=data) |
|
35 | 35 | self.commObj.waitData() |
|
36 | self.commObj.close_socket() | |
|
36 | 37 | |
|
37 | 38 | def changeBeam(self, newBeam): |
|
38 | 39 | |
|
39 | 40 | self.commObj.sendData(cmd="CHGB", data=newBeam) |
|
40 | 41 | self.commObj.waitData() |
|
42 | self.commObj.close_socket() | |
|
41 | 43 | |
|
42 | 44 | def __writeFile(self, filename, data): |
|
43 | 45 | |
@@ -49,6 +51,7 | |||
|
49 | 51 | |
|
50 | 52 | self.commObj.sendData(cmd="ANST", data = data) |
|
51 | 53 | ipSource, ipDestino, cmd, data = self.commObj.waitData() |
|
54 | self.commObj.close_socket() | |
|
52 | 55 | self.__writeFile("report.txt", data) |
|
53 | 56 | |
|
54 | 57 | ########## |
@@ -86,7 +86,8 | |||
|
86 | 86 | self.ipDestino = ipDestino |
|
87 | 87 | self.portDestino = portDestino |
|
88 | 88 | self.addr = (ipDestino,portDestino) |
|
89 | self.addr2 = ("none",0) | |
|
89 | ||
|
90 | self.sc = "none" | |
|
90 | 91 | self.answer = "none" #test |
|
91 | 92 | self.mode = "none" |
|
92 | 93 | |
@@ -114,16 +115,18 | |||
|
114 | 115 | |
|
115 | 116 | self.socket_c.bind(self.addr) |
|
116 | 117 | self.socket_c.listen(1) |
|
117 |
s |
|
|
118 | sc, addr = self.socket_c.accept() | |
|
119 | self.sc = sc | |
|
120 | self.answer = addr | |
|
118 | 121 | print "\nServer initialized" |
|
119 | 122 | |
|
120 | 123 | def waitData(self, nbytes = 16384): |
|
121 | 124 | |
|
122 | 125 | print "\nWaiting some data" |
|
123 | 126 | if self.mode == "client": |
|
124 |
trama_rx |
|
|
127 | trama_rx = self.socket_c.recv(nbytes) | |
|
125 | 128 | else: |
|
126 |
trama_rx |
|
|
129 | trama_rx = self.sc.recv(nbytes) | |
|
127 | 130 | |
|
128 | 131 | print "\nThis socket has received some data from:" |
|
129 | 132 | print self.answer |
@@ -158,6 +161,10 | |||
|
158 | 161 | |
|
159 | 162 | return ipSource, ipDestino, cmd, data |
|
160 | 163 | |
|
164 | def close_socket(): | |
|
165 | self.socket_c.close() | |
|
166 | ||
|
167 | ||
|
161 | 168 | #class FTPComm: |
|
162 | 169 | # |
|
163 | 170 | # ftp_servidor = 'ftp.servidor.com' |
General Comments 0
You need to be logged in to leave comments.
Login now