@@ -8,7 +8,7 | |||||
8 | No newline at end of file |
|
8 | ||
9 | class ABSClient: No newline at end of file |
|
9 | class ABSClient: | |
10 |
|
10 | |||
No newline at end of file |
|
11 | def __init__(self,ipSource="localhost", ipDestino="192.168.1.100", portDestino=7000): No newline at end of file | ||
11 | def __init__(self,ipSource="localhost", ipDestino="192.168.1.117", portDestino=7000): No newline at end of file |
|
|||
12 | No newline at end of file |
|
12 | ||
13 | self.ipSource = ipSource No newline at end of file |
|
13 | self.ipSource = ipSource | |
14 | self.ipDestino = ipDestino No newline at end of file |
|
14 | self.ipDestino = ipDestino |
@@ -114,19 +114,26 | |||||
114 | def configAsServer(self): No newline at end of file |
|
114 | def configAsServer(self): | |
115 | No newline at end of file |
|
115 | ||
116 | self.socket_c.bind(self.addr) No newline at end of file |
|
116 | self.socket_c.bind(self.addr) | |
|
117 | ||||
|
No newline at end of file | ||||
|
118 | def waitData(self, nbytes = 1024): | |||
|
No newline at end of file | ||||
|
119 | ||||
|
No newline at end of file | ||||
|
120 | print "\nWaiting some client." | |||
|
No newline at end of file | ||||
|
121 | ||||
|
No newline at end of file | ||||
|
122 | if self.mode == "client": | |||
|
No newline at end of file | ||||
|
123 | # Short data through ethernet | |||
|
No newline at end of file | ||||
|
124 | trama_rx = self.socket_c.recv(nbytes) | |||
|
No newline at end of file | ||||
|
125 | else: No newline at end of file | |||
117 | self.socket_c.listen(1) No newline at end of file |
|
126 | self.socket_c.listen(1) | |
118 | sc, addr = self.socket_c.accept() No newline at end of file |
|
127 | sc, addr = self.socket_c.accept() | |
119 | self.sc = sc No newline at end of file |
|
128 | self.sc = sc | |
120 |
self.answer = addr |
|
129 | self.answer = addr | |
No newline at end of file |
|
130 | # Big data through ethernet | ||
121 | print "\nServer initialized" |
|
No newline at end of file | ||
No newline at end of file |
|
131 | trama_rx = "" | ||
122 |
|
No newline at end of file | |||
No newline at end of file |
|
132 | while True: | ||
123 | def waitData(self, nbytes = 16384): |
|
No newline at end of file | ||
No newline at end of file |
|
133 | tmp = self.sc.recv(nbytes) | ||
124 |
|
No newline at end of file | |||
No newline at end of file |
|
134 | trama_rx = trama_rx + tmp | ||
125 | print "\nWaiting some data" |
|
No newline at end of file | ||
No newline at end of file |
|
135 | if trama_rx[-4:] == "quit": | ||
126 | if self.mode == "client": |
|
No newline at end of file | ||
No newline at end of file |
|
136 | break No newline at end of file | ||
127 | trama_rx = self.socket_c.recv(nbytes) |
|
|||
No newline at end of file |
|
||||
128 | else: |
|
|||
No newline at end of file |
|
||||
129 | trama_rx = self.sc.recv(nbytes) No newline at end of file |
|
|||
130 | No newline at end of file |
|
137 | ||
131 | print "\nThis socket has received some data from:" No newline at end of file |
|
138 | print "\nThis socket has received some data from:" | |
132 | print self.answer No newline at end of file |
|
139 | print self.answer |
@@ -4,7 +4,7 | |||||
4 | No newline at end of file |
|
4 | ||
5 | class ABSServer: No newline at end of file |
|
5 | class ABSServer: | |
6 |
|
6 | |||
No newline at end of file |
|
7 | def __init__(self,ipSource="localhost", ipDestino="192.168.1.100", portDestino=7000, ipDestino2="192.168.1.225", portDestino2=5500, ftpPortDestino=None): No newline at end of file | ||
7 | def __init__(self,ipSource="localhost", ipDestino="192.168.1.117", portDestino=7000, ipDestino2="192.168.1.225", portDestino2=5500, ftpPortDestino=None): No newline at end of file |
|
|||
8 | No newline at end of file |
|
8 | ||
9 | self.ipSource = ipSource No newline at end of file |
|
9 | self.ipSource = ipSource | |
10 | self.ipDestino = ipDestino No newline at end of file |
|
10 | self.ipDestino = ipDestino |
General Comments 0
You need to be logged in to leave comments.
Login now