예제 #1
0
 def __init__(self, args):
     self._args = args
     self._proxy = ServerProxy(
         'http://localhost:%d/%s/' %
         (get_daemon_port(), rclpy.get_rmw_implementation_identifier()),
         allow_none=True)
     self._methods = []
예제 #2
0
def is_daemon_running(args):
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack('ii', 1, 0))
    addr = ('localhost', get_daemon_port())
    try:
        s.bind(addr)
    except socket.error as e:
        if e.errno == errno.EADDRINUSE:
            return True
    finally:
        s.close()
    return False
예제 #3
0
def is_daemon_running(args):
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    if platform.system() != 'Windows':
        s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    addr = ('localhost', get_daemon_port())
    try:
        s.bind(addr)
    except socket.error as e:
        if e.errno == errno.EADDRINUSE:
            return True
    else:
        s.close()
    return False
예제 #4
0
 def __init__(self, args):
     self._args = args
     self._proxy = ServerProxy('http://localhost:%d/ros2cli/' %
                               get_daemon_port(),
                               allow_none=True)
     self._methods = []