def __init__(self, ip='127.0.0.1', port=13400, activate_routing=True, source_address=0xe80, target_address=0, activation_type=0): # type: (str, int, bool, int, int, int) -> None self.ip = ip self.port = port self.source_address = source_address s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.connect((self.ip, self.port)) StreamSocket.__init__(self, s, DoIP) if activate_routing: resp = self.sr1(DoIP(payload_type=0x5, activation_type=activation_type, source_address=source_address), verbose=False, timeout=1) if resp and resp.payload_type == 0x6 and \ resp.routing_activation_response == 0x10: self.target_address = target_address or \ resp.logical_address_doip_entity print("Routing activation successful! " "Target address set to: 0x%x" % self.target_address) else: print("Routing activation failed! Response: %s" % repr(resp))
def _init_socket(self, sock_family=socket.AF_INET): # type: (int) -> None s = socket.socket(sock_family, socket.SOCK_STREAM) s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.connect((self.ip, self.port)) StreamSocket.__init__(self, s, DoIP)
def __init__(self, ip='127.0.0.1', port=6801): # type: (str, int) -> None self.ip = ip self.port = port s = socket.socket() s.connect((self.ip, self.port)) StreamSocket.__init__(self, s, HSFZ)
def __init__(self, ip='127.0.0.1', port=6801): # type: (str, int) -> None self.ip = ip self.port = port s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.connect((self.ip, self.port)) StreamSocket.__init__(self, s, HSFZ)
def __init__(self, sock, keep_alive=True): """ Initializes the NI stream socket. @param sock: socket @type sock: C{socket} @param keep_alive: if true, the socket will automatically respond to keep-alive request messages. Otherwise, the keep-alive messages are passed to the caller in L{recv} and L{sr} calls. @type keep_alive: C{bool} """ StreamSocket.__init__(self, sock, Raw) self.keep_alive = keep_alive
def __init__(self, sock, keep_alive=True, base_cls=None): """Initializes the NI stream socket. :param sock: socket to wrap :type sock: C{socket} :param keep_alive: if true, the socket will automatically respond to keep-alive request messages. Otherwise, the keep-alive messages are passed to the caller in :class:`recv` and :class:`sr` calls. :type keep_alive: ``bool`` :param base_cls: the base class to use when receiving packets, it uses :class:`SAPNI` as default if no class specified :type base_cls: :class:`Packet` class """ StreamSocket.__init__(self, sock, Raw) self.keep_alive = keep_alive self.basecls = base_cls
def __init__(self, sock, keep_alive=True, base_cls=None): """Initializes the NI stream socket. @param sock: socket to wrap @type sock: C{socket} @param keep_alive: if true, the socket will automatically respond to keep-alive request messages. Otherwise, the keep-alive messages are passed to the caller in L{recv} and L{sr} calls. @type keep_alive: C{bool} @param base_cls: the base class to use when receiving packets, it uses L{SAPNI} as default if no class specified @type base_cls: L{Packet} class """ StreamSocket.__init__(self, sock, Raw) self.keep_alive = keep_alive self.basecls = base_cls
def __init__(self, sock, keep_alive=True, base_cls=None): """Initializes the NI stream socket. @param sock: socket to wrap @type sock: C{socket} @param keep_alive: if true, the socket will automatically respond to keep-alive request messages. Otherwise, the keep-alive messages are passed to the caller in L{recv} and L{sr} calls. @type keep_alive: C{bool} @param base_cls: the base class to use when receiving packets, it uses L{SAPNI} as default if no class specified @type base_cls: L{Packet} class """ StreamSocket.__init__(self, sock, Raw) self.keep_alive = keep_alive self.basecls = base_cls
def __init__(self, sock, keep_alive=True, base_cls=None): """Initializes the NI stream socket. :param sock: socket to wrap :type sock: C{socket} :param keep_alive: if true, the socket will automatically respond to keep-alive request messages. Otherwise, the keep-alive messages are passed to the caller in :class:`recv` and :class:`sr` calls. :type keep_alive: ``bool`` :param base_cls: the base class to use when receiving packets, it uses :class:`SAPNI` as default if no class specified :type base_cls: :class:`Packet` class """ StreamSocket.__init__(self, sock, Raw) self.keep_alive = keep_alive self.basecls = base_cls
def __init__(self, ip='127.0.0.1', port=6801): s = socket.socket() s.connect((ip, port)) StreamSocket.__init__(self, s, DoIP)
def __init__(self, ip='127.0.0.1', port=6801): self.ip = ip self.port = port s = socket.socket() s.connect((self.ip, self.port)) StreamSocket.__init__(self, s, HSFZ)
def __init__(self, ip='127.0.0.1', port=6801): s = socket.socket() s.connect((ip, port)) StreamSocket.__init__(self, s, DoIP)