pycomm3/clx.py
def _forward_open(self):
        """
        Opens a new connection with the target PLC using the *Forward Open* or *Extended Forward Open* service.

        :return: True if connection is open or was successfully opened, False otherwise
        """

        if self._target_is_connected:
            return True

        if self._session == 0:
            raise CommError("A Session Not Registered Before forward_open.")

        init_net_params = 0b_0100_0010_0000_0000  # CIP Vol 1 - 3-5.5.1.1

        if self.attribs['extended forward open']:
            net_params = Pack.udint((self.connection_size & 0xFFFF) | init_net_params << 16)
        else:
            net_params = Pack.uint((self.connection_size & 0x01FF) | init_net_params)

        route_path = Pack.epath(self.attribs['cip_path'] + MSG_ROUTER_PATH)
        service = ConnectionManagerService.forward_open if not self.attribs['extended forward open'] else ConnectionManagerService.large_forward_open

        forward_open_msg = [
            PRIORITY,
            TIMEOUT_TICKS,
            b'\x00\x00\x00\x00',
            self.attribs['cid'],
            self.attribs['csn'],
            self.attribs['vid'],
            self.attribs['vsn'],
            TIMEOUT_MULTIPLIER,
            b'\x00\x00\x00',
            b'\x01\x40\x20\x00',
            net_params,
            b'\x01\x40\x20\x00',
            net_params,
            TRANSPORT_CLASS,
        ]

        response = self.generic_message(
            service=service,
            class_code=ClassCode.connection_manager,
            instance=ConnectionManagerInstance.open_request,
            request_data=b''.join(forward_open_msg),
            route_path=route_path,
            connected=False,
            name='__FORWARD_OPEN__'
        )

        if response:
            self._target_cid = response.value[:4]
            self._target_is_connected = True
            return True
        self.__log.warning(f"forward_open failed - {response.error}")
        return False

        Opens a new connection with the target PLC using the *Forward Open* or *Extended Forward Open* service.

        :return: True if connection is open or was successfully opened, False otherwise
        
Opens a new connection with the target PLC using the *Forward Open* or *Extended Forward Open* service.
Opens a new connection with the target PLC using the * Forward Open * or * Extended Forward Open * service .
def _forward_open(self):
        if self._target_is_connected:
            return True
        if self._session == 0:
            raise CommError("A Session Not Registered Before forward_open.")
        init_net_params = 0b_0100_0010_0000_0000  
        if self.attribs['extended forward open']:
            net_params = Pack.udint((self.connection_size & 0xFFFF) | init_net_params << 16)
        else:
            net_params = Pack.uint((self.connection_size & 0x01FF) | init_net_params)
        route_path = Pack.epath(self.attribs['cip_path'] + MSG_ROUTER_PATH)
        service = ConnectionManagerService.forward_open if not self.attribs['extended forward open'] else ConnectionManagerService.large_forward_open
        forward_open_msg = [
            PRIORITY,
            TIMEOUT_TICKS,
            b'\x00\x00\x00\x00',
            self.attribs['cid'],
            self.attribs['csn'],
            self.attribs['vid'],
            self.attribs['vsn'],
            TIMEOUT_MULTIPLIER,
            b'\x00\x00\x00',
            b'\x01\x40\x20\x00',
            net_params,
            b'\x01\x40\x20\x00',
            net_params,
            TRANSPORT_CLASS,
        ]
        response = self.generic_message(
            service=service,
            class_code=ClassCode.connection_manager,
            instance=ConnectionManagerInstance.open_request,
            request_data=b''.join(forward_open_msg),
            route_path=route_path,
            connected=False,
            name='__FORWARD_OPEN__'
        )
        if response:
            self._target_cid = response.value[:4]
            self._target_is_connected = True
            return True
        self.__log.warning(f"forward_open failed - {response.error}")
        return False
def _forward_open ( self ) : if self . _target_is_connected : return True if self . _session == 0 : raise CommError ( "A Session Not Registered Before forward_open." ) init_net_params = 0b_0100_0010_0000_0000 if self . attribs [ 'extended forward open' ] : net_params = Pack . udint ( ( self . connection_size & 0xFFFF ) | init_net_params << 16 ) else : net_params = Pack . uint ( ( self . connection_size & 0x01FF ) | init_net_params ) route_path = Pack . epath ( self . attribs [ 'cip_path' ] + MSG_ROUTER_PATH ) service = ConnectionManagerService . forward_open if not self . attribs [ 'extended forward open' ] else ConnectionManagerService . large_forward_open forward_open_msg = [ PRIORITY , TIMEOUT_TICKS , b'\x00\x00\x00\x00' , self . attribs [ 'cid' ] , self . attribs [ 'csn' ] , self . attribs [ 'vid' ] , self . attribs [ 'vsn' ] , TIMEOUT_MULTIPLIER , b'\x00\x00\x00' , b'\x01\x40\x20\x00' , net_params , b'\x01\x40\x20\x00' , net_params , TRANSPORT_CLASS , ] response = self . generic_message ( service = service , class_code = ClassCode . connection_manager , instance = ConnectionManagerInstance . open_request , request_data = b'' . join ( forward_open_msg ) , route_path = route_path , connected = False , name = '__FORWARD_OPEN__' ) if response : self . _target_cid = response . value [ : 4 ] self . _target_is_connected = True return True self . __log . warning ( f"forward_open failed - {response.error}" ) return False
Opens a new connection with the target PLC using the *Forward Open* or *Extended Forward Open* service.
Opens a new connection with the target PLC using the * Forward Open * or * Extended Forward Open * service .
"""
        Opens a new connection with the target PLC using the *Forward Open* or *Extended Forward Open* service.

        :return: True if connection is open or was successfully opened, False otherwise
        """ # CIP Vol 1 - 3-5.5.1.1
True if connection is open or was successfully opened, False otherwise
True if connection is open or was successfully opened False otherwise
self