Ejemplo n.º 1
0
class PYTFTPServer(object):
    def __init__(self, tftp_ip_addr, tftp_folder, tftp_log_level):
        self.tftp_ip_addr = tftp_ip_addr
        self.tftp_folder = tftp_folder
        self.tftp_server = TftpServer(self.tftp_folder)
        self.tftp_log_level = tftp_log_level

    def start_tftp_server(self):
        try:
            self.tftp_server.listen(self.tftp_ip_addr, 69)
        except KeyboardInterrupt:
            pass

    def stop_tftp_server(self):
        self.tftp_server.stop()  # Do not take any new transfers, but complete the existing ones.
Ejemplo n.º 2
0
class Server(object):

    _server = None
    _ip = None
    _port = None
    _path = None

    def __init__(self, path='/var/local/hydratk'):

        self._server = TftpServer(tftproot=path)
        self._path = path

    def start(self, ip='127.0.0.1', port=69, timeout=10):

        self._server.listen(ip, port, timeout)
        self._ip = ip
        self._port = port

    def stop(self):

        self._server.stop()