From dd07ff4d686f07cdc9736627dd0ef099ef5e4e4f Mon Sep 17 00:00:00 2001 From: troido Date: Fri, 6 Mar 2020 11:26:59 +0100 Subject: new directory structure for the separate client repo --- asciifarm/client/connection.py | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 asciifarm/client/connection.py (limited to 'asciifarm/client/connection.py') 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) -- cgit