Sending and receiving data through a TCP/IP client connection, delimiting the record by closing the output stream (asynchronous)

Send data through a TCP/IP client connection and receive data back on the same connection (asynchronously), by the use of a message flow with MQInput, TCPIPClientOutput, TCPIPClientInput, and MQOutput nodes.

About this task

Scenario: An application sends asynchronous data between TCP/IP client connections.

Instructions: The following steps describe how to create a message flow to send data through a client connection and wait on the same connection for a reply to be returned. The request is performed asynchronously in two different flows; the TCPIPClientInput node does not wait for data to be returned on this connection, but monitors all available connections. The outgoing record is delimited by closing the output stream, and the reply message is delimited by the remote server closing the input stream. The connection is then completely closed by the node.

Procedure

  1. Create a message flow called TCPIP_Task18 with an MQInput node, a TCPIPClientOutput, a TCPIPClientInput node, and an MQOutput node.
    For more information, see Creating a message flow.
  2. Connect the Out terminal of the MQInput node to the In terminal of the TCPIPClientOutput node.
  3. Connect the Out terminal of the TCPIPClientInput node to the In terminal of the MQOutput node.
    One message flow consisting of MQInput and TCPIPClientOutput nodes, and another message flow consisting of TCPIPClientInput, and MQOutput nodes.
  4. On the MQInput node, set the Queue name property (on the Basic tab) to TCPIP.TASK18.IN1.
  5. Set the following properties of the TCPIPClientOutput node:
    1. On the Basic tab, set the Connection details property to 14158.
    2. On the Advanced tab, select Close output stream after a record has been sent.
    3. On the Records and elements tab, set the Record definition property to Record is unmodified data.
  6. Set the following properties of the TCPIPClientInput node:
    1. On the Basic tab, set the Connection details property to 14158.
    2. On the Advanced tab, set the Close connection property to After data has been received.
    3. On the Records and elements tab, set the Record detection property to End of stream.
  7. On the MQOutput node, set the Queue name property (on the Basic tab) to TCPIP.TASK18.OUT1.
  8. Save the message flow.