FB_IpEndSession
The function block closes an open session. A positive edge of bStart closes the session and releases resources.

INPUT
VAR_INPUT
bStart : BOOL;
iSession : WORD;
END_VAR
bStart: A rising edge activates the function block.
iSession: Is linked with the session number from function block FB_IpStartSession.
OUTPUT
VAR_OUTPUT
bBusy : BOOL;
bError : BOOL;
iErrorId : WORD;
END_VAR
bBusy: This output remains TRUE until execution of the command is complete.
bError: This output is switched to TRUE as soon as an error occurs during the execution of a command. The command-specific error code is contained in iErrorId.
iErrorId: Contains the command-specific error code of the most recently executed command (see table).