Connect to a message router and send messages

If the application expects to send multiple messages to one or more CIP objects in the same CIP module, greater reliability and efficiency can be obtained by establishing a connection to the message router in that module and sending the messages over that connection, rather than sending each message unconnected.
To use this method of CIP communication, complete the following steps:
  1. Specify a path to the CIP module containing the target object.
    This is accomplished in exactly the same way as for sending unconnected messages, using a DTSA_AB_CIP_PATH structure.
  2. Call DTL_CIP_CONNECTION_OPEN to open a connection (or DTL_CIP_LARGE_CONNECTION_OPEN to open a large connection) to the message router.
    • This function (see DTL_CIP_CONNECTION_OPEN and DTL_CIP_LARGE_CONNECTION_OPEN) builds and sends an NI_OPEN service request to the Message Router.
    • One of the parameters to the DTL_CIP_CONNECTION_OPEN (or DTL_CIP_LARGE_CONNECTION_OPEN) function is a pointer to a connection structure containing the connection parameters for the NI_OPEN service request. In this structure, CIP transport class 3 must be specified, with the RSLinx Classic client application taking the role of client.
    • Another of the parameters to the DTL_CIP_CONNECTION_OPEN (or DTL_CIP_LARGE_CONNECTION_OPEN) function is an IOI (internal object identifier), which must be set to specify the logical address of the message router in the target CIP module.
    • The application should also provide a callback function (of type DTL_CIP_CONNECTION_STATUS_PROC) which RSLinx Classic can call when the connection is successfully established or closed, or when it is rejected or times out.
    • The DTL_CIP_CONNECTION_OPEN (or DTL_CIP_LARGE_CONNECTION_OPEN) function will return a connection ID for the application to use in later references to the connection.
  3. Wait for the connection to be established.
    When the connection is successfully established, RSLinx Classic will call the DTL_CIP_CONNECTION_STATUS_PROC specified by the application in its DTL_CIP_CONNECTION_OPEN (or DTL_CIP_LARGE_CONNECTION_OPEN) call. The indicated status will be DTL_CONN_ESTABLISHED. (If the connection could not be established, the status will be DTL_CONN_ERROR or DTL_CONN_FAILED. See DTL_CIP_CONNECTION_STATUS_PROC.)
  4. Use the connection to send messages.
    The application can send messages (receive responses) in exactly the same manner as for unconnected messages, except that the DTSA_AB_CIP_CONN structure must be used instead of the DTSA_AB_CIP_PATH structure (see Data Table Structured Address). The connection ID from the DTL_CIP_CONNECTION_OPEN (or DTL_CIP_LARGE_CONNECTION_OPEN) call must be specified in the DTSA_AB_CIP_CONN structure.
  5. Call DTL_CIP_CONNECTION_CLOSE (or DTL_CIP_LARGE_CONNECTION_CLOSE to close the large connection) to close the connection to the Message Router.
    This function (see DTL_CIP_CONNECTION_CLOSE and DTL_CIP_LARGE_CONNECTION_CLOSE) builds and sends a CLOSE service request to the connected Message Router. The connection ID returned from the DTL_CIP_CONNECTION_OPEN (or DTL_CIP_LARGE_CONNECTION_OPEN) call is used to identify the connection.
  6. Wait for the connection to be closed.
    • When the connection is successfully closed, RSLinx Classic will call the DTL_CIP_CONNECTION_STATUS_PROC function specified by the application in its DTL_CIP_CONNECTION_OPEN (or DTL_CIP_LARGE_CONNECTION_OPEN) call. The indicated status will be DTL_CONN_CLOSED. (If the connection could not be closed cleanly, the status will be DTL_CONN_ERROR or DTL_CONN_FAILED. See DTL_CIP_CONNECTION_STATUS_PROC.)
    • RSLinx Classic will also terminate a connection if the connection times out. In this case, RSLinx Classic will call the DTL_CIP_CONNECTION_STATUS_PROC function with a status of DTL_CONN_TIMEOUT.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal