diff options
Diffstat (limited to 'asciifarm/client/connection.py')
| -rw-r--r-- | asciifarm/client/connection.py | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/asciifarm/client/connection.py b/asciifarm/client/connection.py deleted file mode 100644 index 0a188c3..0000000 --- a/asciifarm/client/connection.py +++ /dev/null @@ -1,30 +0,0 @@ - -import socket - -from asciifarm.common.tcommunicate import send, receive - -class Connection: - - def __init__(self, socketType): - if socketType == "abstract" or socketType == "unix": - sockType = socket.AF_UNIX - elif socketType == "inet": - sockType = socket.AF_INET - else: - raise ValueError("Invalid socket type: %r" % (socketType,)) - self.sock = socket.socket(sockType, socket.SOCK_STREAM) - - def connect(self, address): - self.sock.connect(address) - - def listen(self, callback, onError): - while True: - try: - data = receive(self.sock) - except Exception as err: - onError(err) - else: - callback(data) - - def send(self, message): - send(self.sock, message) |
