FB_IpSend
The function block sends data via TCP or UDP. Which of the connections is used is specified in FB_IpStartSession. In pBuffAddr the pointer to the variable containing data for sending is specified via "ADR". cbBuffLen indicates the length of the data. sRemoteIPAddr indicates the IP address to which the data are sent. With iPortNo this is linked with the port number of FB_IpOpen in TCP. With UDP any port number can be used. iPortNo is the sender port number. The function block is activated and the data are sent with a rising edge of bStart. bBusy is TRUE as long the function block is active. Once the data have been sent bBusy switches to FALSE. bError also remains FALSE. If an error occurs bError is set.

INPUT
VAR_INPUT
bStart : BOOL;
iSession : WORD;
sRemoteIPAddr : STRING(15);
pBuffAddr : DWORD;
cbBuffLen : WORD;
END_VAR
bStart: A rising edge activates the function block.
iSession: Is linked with the session number from function block FB_IpStartSession.
sRemoteIPAddr: IP port number of the device to which data are to be sent.
iPortNo: Sender port number. For TCP the port number from the FB_IpOpen function block must be used, for UDP any port number can be used.
pBuffAddr: Pointer to the data to be sent (command: ADR).
cbBuffLen: Length of the data to be sent. The length should always be less or equal the variable to which the pointer of pBuffAddr points (command: SIZEOF)
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).