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 # An already-connected socket should be passed in, then this class
# suffixed with _gtp, so that this can be subclassed easily, # can be used to handle GTP simply
# e.g. for communicating with a server
import socket
class GTPSocket: class GTPSocket:
def __init__(self, info): def __init__(self, socket):
self.info = info
self.socket = None self.socket = None
self.id = None
def connect(self):
try:
self.socket = socket.create_connection(info)
return True
except:
return False
def get_gtp(self): def get_gtp(self):
msg = None msg = None