Пример #1
0
class FClient:
    def __init__(self, addr, port):
        self.addr = addr
        self.port = port
        self.conn = None
        self.__isRunning = True
        self.fileSendScheduler = FileSendScheduler(self)

    def connectServer(self):
        self.conn = socket(AF_INET, SOCK_STREAM)
        self.conn.connect((self.addr, self.port))
        self.fileSendScheduler.start()

    def sendFile(self, filepath):
        self.fileSendScheduler.commitTask(filepath)

    def closeConn(self):
        if self.conn != None:
            self.conn.close()

    def isRunning(self):
        return self.__isRunning

    def getConnect(self):
        return self.conn
Пример #2
0
 def __init__(self, addr, port):
     self.addr = addr
     self.port = port
     self.conn = None
     self.__isRunning = True
     self.fileSendScheduler = FileSendScheduler(self)