Sending and receiving data on the same TCP/IP client connection, closing input and output streams (synchronous)

Send data through a TCP/IP client connection and wait on the same connection for a reply to be returned, by the use of a message flow with MQInput, TCPIPClientOutput, TCPIPClientReceive, and MQOutput nodes.

About this task

Scenario: An application sends synchronous data on the same TCP/IP client connection.

Instructions: The following steps describe how to create a message flow that sends out data through a client connection and waits on the same connection for a reply to be returned. The request is synchronous within the same flow, as a result of the TCPIPClientReceive node waiting for data to be returned. The outgoing message is delimited by closing the output stream, and the reply data is delimited by the remote application closing the input stream.

Procedure

  1. Create a message flow called TCPIP_Task19 with an MQInput node, a TCPIPClientOutput node, a TCPIPClientReceive 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 TCPIPClientOutput node to the In terminal of the TCPIPClientReceive node.
  4. Connect the Out terminal of the TCPIPClientReceive node to the In terminal of the MQOutput node.
    Message flow consisting of MQInput, TCPIPClientOutput, TCPIPClientReceive, and MQOutput nodes.
  5. On the MQInput node, set the Queue name property (on the Basic tab) to TCPIP.TASK19.IN1.
  6. Set the following properties of the TCPIPClientOutput node:
    1. On the Basic tab, set the Connection details property to 14159.
    2. On the Advanced tab, set the following properties:
      • Select Close output stream after a record has been sent.
      • Set the Input stream modification property to Reserve input stream and release at end of flow. It is important to reserve the input stream so that it is not closed before the receive node processes the return data.
    3. On the Records and elements tab, set the Record definition property to Record is Unmodified Data.
  7. Set the following properties of the TCPIPClientReceive node:
    1. On the Basic tab, set the Connection details property to 14159.
    2. On the Advanced tab, set the Close connection property to After data has been received.
    3. On the Request tab, set the ID location property to $LocalEnvironment/WrittenDestination/TCPIP/Output/ConnectionDetails[1]/Id.
    4. On the Records and elements tab, set the Record detection property to Connection closed.
  8. On the MQOutput node, set the Queue name property (on the Basic tab) to TCPIP.TASK19.OUT1.
  9. Save the message flow.