diff -r 27e83a8f68d7 -r 00a5cf92ec21 gmyth-stream/plugins/comm/tcp.py --- a/gmyth-stream/plugins/comm/tcp.py Tue Apr 03 16:42:04 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -import lib -import time -import socket - -class Server: - - def __init__(self, config): - self.host = '' - self.port = int(config.get("Comm", "port")) - self.finish = 0 - - self.tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.tcp.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - self.tcp.bind( (self.host, self.port) ) - self.tcp.listen(1) - - def getMsg(self, size): - return self.con.recv(size) - - def sendMsg(self, msg): - self.con.send(msg + "\n") - - def Ack(self, command): - msg = "[%s] Command %s received" % (lib.now(), command) - self.sendMsg(msg) - - def getRequest(self): - self.con, self.client = self.tcp.accept() - print "[%s] Received request from ip=%s" % (lib.now(), self.client ) - return (self.con, self.client) - - def disconnect_client(self, connection): - connection.close() - - def stop(self): - self.tcp.close()