Exemplo n.º 1
0
class RxPServer:
    def __init__(self, ip, port, window=1024):
        self.ip = ip
        self.port = port
        self.window = 1024
        self.socket = RxPSocket(ip, port, window)

    def setWindow(self, window):
        logging.debug("[DEBUG] Server set window called.")
        return

    def acceptIncomingConnections(self):
        logging.debug("[DEBUG]: RxPServer is accepting incoming connections-run from the RxPServer class")
        # method stub
        while True:
            #TODO: try except goes here
            self.socket.listen()
            if not self.handleConnection():
                break



    def handleConnection(self):
        data = self.socket.receive()
        if data is None:
            return False
        logging.debug("[DEBUG]I got"+data)
        return True

    def sendClientFile(filename):
        logging.debug("[DEBUG]RxPServer-Going to send client this file: " + filename)

    def post(filename):
        logging.debug("[DEBUG]RxPServer-Going to get this file from client: " + filename)