Change our approach to gtpsocket a bit...

This commit is contained in:
Anna Rose 2012-04-14 23:47:55 -04:00
parent ac0b65ec62
commit 6e2f1649c8

View File

@ -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