File protocol

The File protocol driver reads messages from one file and writes them to another. The driver supports both newline-terminated and 10-byte length-encoded messages.

File is usually used in the testing phase as a sample data file that simulates messages sent across a connection. To test an inbound connection, populate the file with test data before testing. This is data that was captured from the network or individual test messages. To test an outbound connection, save the test data to a file.

Best practices:

  • Guarantee a minimum delay between message reads.
  • Overwrite the outbound file, if it already exists, or append new data to it.

Input pane

This tables shows input configuration options:

Option Description
Filename This names the input file to use and can contain multiple messages. Click Browse to open a file browser.

Use the name of the simulated data file from which input data is read. If testing an outbound thread, then leave the text field blank, or specify the null device (nul: on Windows; /dev/null on UNIX).

  • If an absolute pathname is not specified, then the pathname is relative to the binary directory for the process running under this driver.
  • If a file name is not specified, then the engine uses /dev/null by default, and the driver does not produce any inbound messages.

You must specify a file name in the Input Filename or Output Filename field. Both fields cannot be blank.

CRNL Convert This creates any files on a Windows server as Windows-type files and not as UNIX-type files. CRNL is for Windows and NL is for UNIX. This option is performed on each message (record) in a file.
  • CRNL to NL converts Windows-based files to UNIX-based files.
  • NL to CRNL converts UNIX-based files to Windows-based files.
File Format The driver identifies message boundaries according to the selected file format:
  • Newline terminated ends every message with a newline character (for example, \n).
  • Length-encoded is10-byte length-encoding which prepends 10 ASCII numeric characters, denoting the message length before each message (for example, 0000000007message).
  • End-of-file terminated ends every message with an end-of-file character.
Input Delay This specifies the minimum number of seconds between reading messages from the input file.

As long as the file contains data to read, the driver reads the next message into the engine.

To read messages rapidly, leave the value at 0. Use a larger number to delay each subsequent read to simulate occasional delivery or to give other threads more opportunity to run.

When the driver reaches the end-of-file (EOF), it enters the ineof protocol state. Until the thread restarts, it does not read any more messages. This does not affect outbound data flow.

Output pane

This tables shows output configuration options:

Option Description
Filename This names the outbound message file. Specify the name of the file where output data is stored. Click Browse to open a file browser.

If testing an inbound thread, then leave the text field blank. Similar to the input Filename, it is relative to the process binary directory unless it is an absolute pathname. The process binary directory is the current working directory for the process when it runs.

Specify a file name in the Input Filename or Output Filename field. Both fields cannot be blank.

CRNL Convert This creates any files on a Windows server as Windows-type files and not as UNIX-type files. CRNL is for Windows and NL is for UNIX. This option is performed on each message (record) in a file.
  • CRNL to NL converts Windows-based files to UNIX-based files.
  • NL to CRNL converts UNIX-based files to Windows-based files.
File Format The driver identifies message boundaries according to the selected file format:
  • Newline terminated ends every message with a newline character (for example, \n).
  • Length-encoded is10-byte length-encoding which prepends 10 ASCII numeric characters, denoting the message length before each message (for example, 0000000007message).
  • End-of-File terminated ends every message with an end-of-file character.
Append to file This determines what action the driver takes on start-up when an outbound file exists.

When this is cleared, the outbound message does not append to the output file but instead overwrites the output file.

NL to CRNL conversion

The File protocol does not convert NL to CRNL if the data has 0A and 0D 0A. Before the conversion, the engine checks if CRNL already exists to determine if the data has already been processed.

Any CRNL that exists in the data causes the engine to stop the conversion. This is by design. Otherwise, CRNL is converted to CRNLNL.

File Start-Up Procedures pane

Click Edit to open the TPS Editor.Then, select the procedures to run when the thread starts. This is a Tcl Procedure Stream (TPS). Use it to trade messages with the remote end.