diff options
author | amartin <olpc@xo-02-2E-11.localdomain> | 2007-06-19 01:45:51 (GMT) |
---|---|---|
committer | amartin <olpc@xo-02-2E-11.localdomain> | 2007-06-19 01:45:51 (GMT) |
commit | 58aba141b50ec7843712f9ad8b43c2ae850552a3 (patch) | |
tree | 9de843f75bf1882c8726e4e53a007053f0f22954 /Util/Network.py | |
parent | 432cec6ef36dec2464b59d2391ee684d30e05f29 (diff) |
network
Diffstat (limited to 'Util/Network.py')
-rw-r--r-- | Util/Network.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Util/Network.py b/Util/Network.py index 854f9ad..c439971 100644 --- a/Util/Network.py +++ b/Util/Network.py @@ -235,6 +235,7 @@ class Network: # self.socket.setblocking(0) self.connection[self.socket] = Connection( self.socket, self.hostAddress ) self.socket.connect(self.hostAddress) + self.inputSockets.append(self.socket) if self.listener: self.listener.updateSockets( self.inputsSockets, self.outputSockets, self.exceptSockets ) self.listenerSocket.sendto( "REFRESH", ("localhost", LISTENER_PORT) ) @@ -388,10 +389,12 @@ class Network: for s in inputReady: try: data = s.recv(MAX_SIZE) - if not let(data): # no data to read, socket must be closed + if not len(data): # no data to read, socket must be closed self.setMode( MD_OFFLINE ) else: print data + print len(data) + self.processStream( s, data ) except socket.error, (value, message): print "Network:: error reading data: " + message @@ -399,6 +402,9 @@ class Network: def processStream( self, sock, newData = "" ): con = self.connection[sock] con.recvBuf += newData + print "------------------------------------" + print con.recvBuf + print len(con.recvBuf), ord(con.recvBuf[0]) if con.waitingForData == -1: # message size in char con.waitingForData = ord(con.recvBuf[0]) |