End Of File (-EOF)

The End Of File (-EOF) adapter command defines a single message.

The adapter uses this command when communicating with other programs that invoke and detect calls to the shutdown function as defined by the Socket Application Programming Interface (API). The shutdown function disables any further send or receive operations on a socket connection. It is used to mark the end of one message.

On a data retrieval (GET or input card) operation, the adapter detects the End Of File marker after your program calls the shutdown function on the write end of the socket. All data that is received before the End Of File marker defines the single message that is used during map processing.

On a data routing (PUT or output card) operation, the adapter sends the End Of File marker to your program by calling the shutdown function on the write end of the socket. All data that is sent before the End Of File marker defines the single message that is used by your program.

When you use the End Of File command in a three-parameter GET rule, the following results occur. One message is first sent to the client. The message contains all of the data that is referenced by the third parameter. After one message is received from the client, the adapter then closes the socket connection.

When you use the End Of File command in a two-parameter GET rule or in an input card, you can also use it in a PUT rule or in an output card of the same map. The converse is true as well. When you use the End Of File command in a two-parameter PUT rule or in an output card, you can also use it in a GET rule or in an input card of the same map. After one data retrieval operation and one data routing operation that both use the End Of File command completes processing, your program can close the socket connection.

Because the End Of File command defines only one message for each GET and PUT operation, you cannot specify burst mode or the Quantity (-QTY) adapter command in the command line.

With the End Of File command used on the command line of an input card for a Flow Engine watch event, the map is triggered when the Socket Adapter receives one input message from any client or server connection. The adapter sends a reply to that same client or server connection by using the End Of File command on a data routing (PUT) operation or an output card. Like the three-parameter GET function, the triggered map receives one message and sends one message.

For a Flow Engine watch event, however, the triggered map can divide the one reply message into multiple data routing operations. For instance, you can design the output cards for modularized processing in the following way. Specify one output card to send the header portion of the message. Specify a second output card to send the body portion. You must specify the host name and port number in the command line on both output cards. You must also specify the End Of File command, but only on the second output card. The first output card causes the Socket Adapter to send the first portion of the message, which is the header. After the map invokes the second output card and the Socket Adapter detects the End Of File command, the adapter sends the last portion of the message, which is the body. It then calls the shutdown function to mark the end of the message. Whenever you use the Socket Adapter in this way, remember to use only the End Of File command on the last output card.