PAM Programming Manual

Link-Level Programming Examples
PAM Programming Manual142482
B-20
Closing a PORT
FILEINFO ( L2SAP_file_num, (int *)&file_error );
fprintf(stdout, “SetMode failed - Error: %d\n”, file_error);
exit(Abend_exit);
};
}
/* --------------------- End of Open_ procedure ---------------- */
Closing a PORT
The application must also provide a procedure for closing PORTs.
#pragma page “PROCEDURE: Close_”
/* ----------------------------------------------------------------
PROCEDURE: Close_
---------------------------------------------------------------- */
void Close_()
{
int file_error;
int cc;
cc = CLOSE ( L2SAP_file_num );
if (cc != condition_ok)
{
FILEINFO ( L2SAP_file_num, (int *)&file_error );
fprintf(stdout, “Close failed - Error: %d\n”, file_error);
exit(Abend_exit);
};
}
/* -------------------- End of Close_ procedure ---------------- */
Testing the L2S Interface
The following program tests all of the preceding code. The application program
establishes a working connection between itself and the L2S interface by opening the
PORT that connects the host system to the target LAN through TLAM.
#pragma page “PROCEDURE : Test ( Main )”
/* ----------------------------------------------------------------
PROCEDURE : Test ( Main )
---------------------------------------------------------------- */
main(argc, argv)
int argc;
char *argv[];
{
int cc;
Initialize(argc, argv);
#if SEND
DELAY ( 200 );
#endif
Open_();
while ( Loop_Cnt > 0 )
{
Current_User_Data_Size_B = Begin_User_Data_Size_B;
Aggr_SDUs_left = ( End_User_Data_Size_B -
Begin_User_Data_Size_B + 1 );
do {