summaryrefslogtreecommitdiffstats
path: root/module/socket/SocketServer.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-05-28 14:52:22 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-05-28 14:52:22 +0200
commit88227131086768d62f26be330f3101924ebbb50e (patch)
treea3b1e2582080d065281e7297b2236612944124ae /module/socket/SocketServer.py
parentclean up some code, new config parser, basic time shedule (diff)
downloadpyload-88227131086768d62f26be330f3101924ebbb50e.tar.xz
time shedule fix
Diffstat (limited to 'module/socket/SocketServer.py')
-rw-r--r--module/socket/SocketServer.py59
1 files changed, 0 insertions, 59 deletions
diff --git a/module/socket/SocketServer.py b/module/socket/SocketServer.py
deleted file mode 100644
index 5466195e8..000000000
--- a/module/socket/SocketServer.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/env python
-# -'- coding: utf-8 -*.
-"""
-authored by: RaNaN
-
-This modul class handels all incoming and outgoing data between server and gui
-
-"""
-import threading
-import socket
-import asyncore
-import asynchat
-
-class ServerThread(threading.Thread):
-
- def __init__(self):
- threading.Thread.__init__ (self)
- self.server = MainServerSocket(7272)
-
- def run(self):
- asyncore.loop()
-
- def stop(self):
- asyncore.socket_map.clear()
- self.server.close()
-
-
-class MainServerSocket(asyncore.dispatcher):
- def __init__(self, port):
- print 'initing MSS'
- asyncore.dispatcher.__init__(self)
- self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
- self.bind(('',port))
- self.listen(5)
- def handle_accept(self):
- newSocket, address = self.accept()
- print "Connected from", address
- SecondaryServerSocket(newSocket)
- def handle_close(self):
- print "going to close"
- self.close()
-
-
-
-class SecondaryServerSocket(asynchat.async_chat):
- def __init__(self, *args):
- print 'initing SSS'
- asynchat.async_chat.__init__(self, *args)
- self.set_terminator('\n')
- self.data = []
- def collect_incoming_data(self, data):
- self.data.append(data)
- def found_terminator(self):
- self.push(''.join(self.data))
- self.data = []
- #having fun with the data
- def handle_close(self):
- print "Disconnected from", self.getpeername()
- self.close() \ No newline at end of file