diff -r 000000000000 -r f76bb8743b22 gmyth-stream/plugins/comm/tcp.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gmyth-stream/plugins/comm/tcp.py Tue Mar 27 14:53:51 2007 +0100
@@ -0,0 +1,58 @@
+ '''
+ # GMyth-Stream
+ #
+ # @file main.py
+ #
+ # @brief
Plugin for GMyth-Stream
+ #
+ # Copyright (C) 2007 INdT - Instituto Nokia de Tecnologia.
+ # @author Artur Duque de Souza
+ #
+ #
+ # This program is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU Lesser General Public License as published by
+ # the Free Software Foundation; either version 2 of the License, or
+ # (at your option) any later version.
+ #
+ # This program is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ # GNU General Public License for more details.
+ #
+ # You should have received a copy of the GNU Lesser General Public License
+ # along with this program; if not, write to the Free Software
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ #
+ '''
+
+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.bind( (self.host, self.port) )
+ self.tcp.listen(1)
+
+ def now(self):
+ return time.strftime("%Y-%m-%d %H:%M:%S");
+
+ def getMsg(self, size):
+ con = self.data[0]
+ return con.recv(size)
+
+ def getRequest(self):
+ self.data = self.tcp.accept()
+ print "[%s] Received request from ip=%s" % (self.now(), self.data[1] )
+ return self.data
+
+ def disconnect_client(self, connection):
+ connection.close()
+
+ def stop(self):
+ self.tcp.close()