How the connection is established
The following paragraphs describe the functions the Listener performs in coordinating between the client and the server. With the exception of paragraph 6, the Listener performs the same steps for both explicit- and implicit-mode servers. Paragraph numbers correspond to the step numbers in Figure 8.

- Connection request
The IMS Listener is an IMS batch message processing program (BMP). When the Listener starts, it establishes a socket on which it can
listen
for connection requests. It binds itself to the specified port, and then listens for requests from TCP/IP clients. When a client sends a connection request, MVS™ TCP/IP notifies the Listener of the request. - Connection processing
When the Listener receives a connection request, it issues a socket ACCEPT call, which creates a new socket specifically for that connection.
- Transaction-Request Message
The client then sends a transaction-request message (TRM) segment, which includes the 8-byte name of the requested IMS server transaction (otherwise known as the TRANCODE).
- Transaction verification
The Listener performs several tests to ensure that the requested transaction should be accepted:
- The TRANCODE is tested against IMS Listener configuration file TRANSACTION statements to ensure that the requested transaction is eligible to be run from a TCP/IP client.
- If security data is included in the transaction-request message (TRM), that data is passed to a user-written security exit. The purpose of this exit is to validate the credentials of the client before allowing the transaction to be scheduled.
- The Listener issues an IMS CHNG call to a modifiable alternate PCB, specifying the TRANCODE of the required transaction. It then issues an IMS INQY call to ensure that the transaction is not stopped (due to previous abend or Master Terminal Operator action).
- If the transaction request is rejected, the IMS Listener returns a request-status message (RSM) segment to the client with an indication of the reason for rejecting the request; it then closes the connection.
- If the transaction request is accepted the requested transaction is scheduled (the Listener does not return a status message to the client).
- Transaction Initiation Message (TIM) The Listener then inserts (ISRT) a transaction initiation message (TIM) segment to the IMS message queue. This message contains information needed by the server program when it takes responsibility for the connection.Note: The client sends the transaction request message (TRM) to the Listener. The Listener sends the transaction initiation message (TIM) to the server.
- Client-to-server input data transfer (implicit mode only)
If the transaction is in implicit mode, the Listener reads the client-to-server input data and places it on the message queue.
- Pass the socket to the server
Next, the Listener issues a GIVESOCKET call, which makes the socket available to the server program.
- Schedule the transaction
Finally, the Listener issues an IMS SYNC call to schedule the requested IMS transaction and waits for the server program to take responsibility for the connection.