diff --git a/lib/gtpsocket.py b/lib/gtpsocket.py index a086427..01fd8cf 100644 --- a/lib/gtpsocket.py +++ b/lib/gtpsocket.py @@ -1,24 +1,12 @@ -# A socket class for communicating in Go Text Protocol +# A class for communicating in Go Text Protocol # -# A simple connect method is defined, and everything else is -# suffixed with _gtp, so that this can be subclassed easily, -# e.g. for communicating with a server - -import socket +# An already-connected socket should be passed in, then this class +# can be used to handle GTP simply class GTPSocket: - def __init__(self, info): - self.info = info + def __init__(self, socket): self.socket = None - - - def connect(self): - try: - self.socket = socket.create_connection(info) - return True - except: - return False - + self.id = None def get_gtp(self): msg = None