diff options
| author | ced <> | 2007-01-27 18:04:04 +0000 |
|---|---|---|
| committer | ced <> | 2007-01-27 18:04:04 +0000 |
| commit | bc3c0241136a6f107e3dbe71ae5906727c6ea5e0 (patch) | |
| tree | bc82d5054778d515bde59c3027b3954c41c98b70 /bin/tiny_socket.py | |
| parent | 2160a4733029fea5d76c1d5546b548d1825aee2d (diff) | |
KERNEL & CLIENT: add socket to client
bzr revid: ced-03b3c4b66589c71ef47e688002e648c7887b94ae
Diffstat (limited to 'bin/tiny_socket.py')
| -rw-r--r-- | bin/tiny_socket.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/bin/tiny_socket.py b/bin/tiny_socket.py index e7a9624c7fd..52690d09c1b 100644 --- a/bin/tiny_socket.py +++ b/bin/tiny_socket.py @@ -12,6 +12,9 @@ class mysocket: self.sock.settimeout(60) def connect(self, host, port): self.sock.connect((host, port)) + def disconnect(self): + self.sock.shutdown(socket.SHUT_RDWR) + self.sock.close() def mysend(self, msg, exception=False): msg = cPickle.dumps(msg) size = len(msg) @@ -36,4 +39,8 @@ class mysocket: if chunk == '': raise RuntimeError, "socket connection broken" msg = msg + chunk - return cPickle.loads(msg) + res = cPickle.loads(msg) + if isinstance(res,Exception): + raise res + else: + return res |
