summaryrefslogtreecommitdiff
path: root/asciifarm/client/connection.py
diff options
context:
space:
mode:
authortroido <troido@protonmail.com>2020-03-06 11:26:59 +0100
committertroido <troido@protonmail.com>2020-03-06 11:26:59 +0100
commitdd07ff4d686f07cdc9736627dd0ef099ef5e4e4f (patch)
treef43310b3779a95efd74a40ba8139cf146ad49051 /asciifarm/client/connection.py
parentc9366616079240cd7ee3d243c9f6897d40b4267d (diff)
new directory structure for the separate client repo
Diffstat (limited to 'asciifarm/client/connection.py')
-rw-r--r--asciifarm/client/connection.py30
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)