Class TcpConx

    • Field Detail

      • isEphemeralPort

        protected boolean isEphemeralPort
      • ephemeralVendor

        protected int ephemeralVendor
      • ephemeralSerial

        protected int ephemeralSerial
      • localAddress

        protected java.net.InetSocketAddress localAddress
      • originatorFlag

        public final boolean originatorFlag
      • channel

        protected io.netty.channel.socket.SocketChannel channel
      • peer

        public final java.net.InetSocketAddress peer
      • sessionID

        protected int sessionID
      • cxmap

        protected java.util.Map<java.lang.Integer,​ConxMapItem> cxmap
      • ctxmap

        protected java.util.Map<java.lang.Long,​CipRequest> ctxmap
      • activityTS

        protected long activityTS
      • inFlight

        protected int inFlight
      • inFlightTimeouts

        protected int inFlightTimeouts
      • msgProcQueue

        protected java.util.List<CipRequest> msgProcQueue
    • Constructor Detail

      • TcpConx

        public TcpConx​(ConxClass parent,
                       java.net.InetSocketAddress target)
        Construct and connect an originator connection to a target's UCMM.
        Parameters:
        target - The IP address and port of the target Ethernet/IP device.
      • TcpConx

        protected TcpConx​(ConxClass parent,
                          java.net.InetSocketAddress target,
                          boolean ephemeral)
      • TcpConx

        public TcpConx​(TcpIpPort port,
                       io.netty.channel.socket.SocketChannel channel)
        Construct the target side of a new server connection.
        Parameters:
        port - The Port instance in which this connection will operate.
        channel - The connected channel created by the port in accept().
    • Method Detail

      • makeEphemeral

        public static TcpConx makeEphemeral​(java.net.InetAddress localAddress,
                                            java.net.InetSocketAddress target)
        Construct and connect an originator connection to an Ethernet/IP target's UCMM using a ephemeral Port Object. The TCP/IP connection will use the local address as its source if not null. If null, Netty will choose the local address.
        Parameters:
        localAddress -
        target -
      • getSessionID

        public int getSessionID()
      • setSessionID

        public int setSessionID​(int newSessionID)
      • linkConsume

        public void linkConsume​(long txID,
                                java.nio.ByteBuffer payload)
        Description copied from class: ConxInstance
        Connections must be able to receive arbitrary payloads from port links. These would be TCP or UDP sockets in Ethernet/IP, platform-dependent OS devices in DeviceNet or other physical transports, or peer connections in bridging.

        The connection's watchdog timer is updated on link packet processing.

        Specified by:
        linkConsume in interface LinkConsumer
        Overrides:
        linkConsume in class ConxInstance
        Parameters:
        txID - Link-specific transaction ID. Not always 64 bits, if used at all.
        payload - The CIP payload extracted from the outer transport protocol.
      • send

        public void send​(CipRequest req,
                         int nesting)
        Description copied from interface: CipMsgProcessor
        Given a request and a nesting level, evaluate the request in the UCMM's application context after skipping the specified nested path segments. Route paths may not be present in the application path. Implementations should override this naive default implementation if the request will be executed locally--no need to construct a trimmed request if it will not go over the wire.
        Specified by:
        send in interface CipMsgProcessor
      • msgProcDeQueue

        public void msgProcDeQueue()
      • msgRcvdDeQueue

        public void msgRcvdDeQueue()
      • isOrigin

        public boolean isOrigin()
        Description copied from class: ConxInstance
        Generic CIP connections are either originators or targets. In messaging connections, originators produce requests while targets produce replies.

        Within this protocol implementation, originators produce on the link side with the O2T timing and parameters, and consume on the link side with the T2O timing and parameters.

        When a connection is obtained from a successful Forward Open Response, the recipient must examine whether it is an originator or a target. If an originator, the recipient must assign to the appConsumer field and use the appProduce() method. If a target, the recipient must assign to the linkProducer field and use the linkConsume() method.

        Specified by:
        isOrigin in class ConxInstance
        Returns:
      • getMaxMsg

        public int getMaxMsg()
        Description copied from interface: CipMsgProcessor
        Return this message processor's max allowed message size in bytes. Applies to both request and reply.
        Specified by:
        getMaxMsg in interface CipMsgProcessor
        Returns: