Exemplo n.º 1
0
 def __init__(self, config, auto_sync=5):
     self.rec_sock     = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
     self.rec_sock.bind(("", config.port))
     self.config       = config
     self.client       = pylib_tcp.tcp_client()
     self.slaves       = {}
     self.strats       = pylib_etestset.etestset([], auto_sync)
     self.ctrl_server  = pylib_tcp.tcp_server(config.ctrl_port)
     self.slave_server = pylib_tcp.tcp_server(config.port)
     self.ctrls        = []
Exemplo n.º 2
0
 def __init__(self, config, auto_sync=5):
     self.rec_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
     self.rec_sock.bind(("", config.port))
     self.config = config
     self.client = pylib_tcp.tcp_client()
     self.slaves = {}
     self.strats = pylib_etestset.etestset([], auto_sync)
     self.ctrl_server = pylib_tcp.tcp_server(config.ctrl_port)
     self.slave_server = pylib_tcp.tcp_server(config.port)
     self.ctrls = []
Exemplo n.º 3
0
def eserver_get_reply(address, command):
    """
    Connect to an eserver, issue a command, and return the first
    complete reply (or None) if the connection fails.
    """
    try:
        conn = pylib_tcp.tcp_client().connect(address)
    except (socket.error, socket.timeout):
        pylib_io.verbout("No running server found.")
        return None

    conn.write(command)
    while conn.sendable():
        conn.send()

    res = []
    while not res:
        res = conn.read()
    conn.close()
    return res[0]
Exemplo n.º 4
0
def eserver_get_reply(address, command):
    """
    Connect to an eserver, issue a command, and return the first
    complete reply (or None) if the connection fails.
    """
    try:
        conn = pylib_tcp.tcp_client().connect(address)
    except (socket.error, socket.timeout):
        pylib_io.verbout("No running server found.")
        return None

    conn.write(command)
    while conn.sendable():
        conn.send()

    res = []
    while not res:
        res = conn.read()
    conn.close()
    return res[0]