Index: trunk/absroot/source/abspy/abscontrol/client2.py =================================================================== diff --git a/trunk/absroot/source/abspy/abscontrol/client2.py b/trunk/absroot/source/abspy/abscontrol/client2.py --- a/trunk/absroot/source/abspy/abscontrol/client2.py (revision 70) +++ b/trunk/absroot/source/abspy/abscontrol/client2.py (revision 71) @@ -8,7 +8,7 @@ class ABSClient: - def __init__(self,ipSource="localhost", ipDestino="192.168.1.117", portDestino=7000): + def __init__(self,ipSource="localhost", ipDestino="192.168.1.100", portDestino=7000): self.ipSource = ipSource self.ipDestino = ipDestino Index: trunk/absroot/source/abspy/abscontrol/library.py =================================================================== diff --git a/trunk/absroot/source/abspy/abscontrol/library.py b/trunk/absroot/source/abspy/abscontrol/library.py --- a/trunk/absroot/source/abspy/abscontrol/library.py (revision 70) +++ b/trunk/absroot/source/abspy/abscontrol/library.py (revision 71) @@ -114,19 +114,26 @@ def configAsServer(self): self.socket_c.bind(self.addr) - self.socket_c.listen(1) - sc, addr = self.socket_c.accept() - self.sc = sc - self.answer = addr - print "\nServer initialized" - def waitData(self, nbytes = 16384): + def waitData(self, nbytes = 1024): - print "\nWaiting some data" + print "\nWaiting some client." + if self.mode == "client": + # Short data through ethernet trama_rx = self.socket_c.recv(nbytes) else: - trama_rx = self.sc.recv(nbytes) + self.socket_c.listen(1) + sc, addr = self.socket_c.accept() + self.sc = sc + self.answer = addr + # Big data through ethernet + trama_rx = "" + while True: + tmp = self.sc.recv(nbytes) + trama_rx = trama_rx + tmp + if trama_rx[-4:] == "quit": + break print "\nThis socket has received some data from:" print self.answer @@ -138,14 +145,14 @@ def sendData(self, cmd, data): if self.portDestino == 7000: - trama_tx = self.__HEADER + ":" + str(self.ipSource) + ":" + str(self.ipDestino) + ":" + str(cmd) + ":" + str(data) + ":" + trama_tx = self.__HEADER + ":" + str(self.ipSource) + ":" + str(self.ipDestino) + ":" + str(cmd) + ":" + str(data) + ":" + "quit" else: trama_tx = data # Send messages if self.mode == "client": self.socket_c.send(trama_tx) else: - self.addr2[0].send(trama_tx) + self.sc.send(trama_tx) print "Sending message:[" + trama_tx + "]" def __getTrama(self, trama): @@ -161,9 +168,8 @@ return ipSource, ipDestino, cmd, data - def close_socket(): + def close_socket(self): self.socket_c.close() - #class FTPComm: # Index: trunk/absroot/source/abspy/abscontrol/server2.py =================================================================== diff --git a/trunk/absroot/source/abspy/abscontrol/server2.py b/trunk/absroot/source/abspy/abscontrol/server2.py --- a/trunk/absroot/source/abspy/abscontrol/server2.py (revision 70) +++ b/trunk/absroot/source/abspy/abscontrol/server2.py (revision 71) @@ -4,7 +4,7 @@ class ABSServer: - def __init__(self,ipSource="localhost", ipDestino="192.168.1.117", portDestino=7000, ipDestino2="192.168.1.225", portDestino2=5500, ftpPortDestino=None): + def __init__(self,ipSource="localhost", ipDestino="192.168.1.100", portDestino=7000, ipDestino2="192.168.1.225", portDestino2=5500, ftpPortDestino=None): self.ipSource = ipSource self.ipDestino = ipDestino @@ -23,7 +23,7 @@ asServer = True self.commServerObj = library.TCPComm(self.ipSource, self.ipDestino, self.portDestino, asServer) -# self.commClientObj = library.TCPComm(self.ipSource, self.ipDestino2, self.portDestino2) + self.commClientObj = library.UDPComm(self.ipSource, self.ipDestino2, self.portDestino2) #self.ftpCommObj = library.FTPComm(self.ipSource, self.ipDestino, self.ftpPortDestino) @@ -34,8 +34,7 @@ datarpta = "OK" if cmd == "SNDF": -# self.sendFile2Modules() - pass + self.sendFile2Modules() if cmd == "CHGB": self.changeBeam()