FCT_RECEIVE: Retrieves Data Available on a Socket
(Original Document)
Function Description
The FCT_RECEIVE function looks for the data available on the socket. The maximum length of data to read is 240 bytes.
It returns the numbers of bytes read in the socket. You should always test this value \because it is the only way to check the actual number of data bytes stored in the user buffer.
NOTE: FCT_RECEIVE does not return out-of-band data.
The additional parameters EN and ENO may be configured.
Representation in FBD
Representation in LD
Representation in IL
LD Module_Number
FCT_RECEIVE Socket_Number, Pbuf_Index, Gest_Index, Management_Param, Received_Data
Representation in ST
FCT_RECEIVE(Module_Number, Socket_Number, Pbuf_Index, Gest_Index, Management_Param, Received_Data);
Description of Parameters
The following table describes the input parameters:
Parameter
Type
Comment
Module_Number
Slot number of network module in rack 0.
  • Low byte is the slot number of the network module in rack 0.
  • High byte can be used to extend the number of sockets.
    • 00: Provided for full backward compatibility with applications created on firmware version 3.3 or earlier.
    • 01: Up to 64 sockets can be used (firmware version must be higher than 3.3).
Socket_Number
Socket number
Pbuf_Index
Index of first word in Received_Data array
Gest_Index
Index of first word in Management_Param array
The following table describes the output parameters:
Parameter
Type
Comment
Received_Data
ARRAY [0... n] OF INT
Array of maximum of 240 bytes containing the data read on the socket
The following table describes the input/output parameters:
Parameter
Type
Comment
Management_Param
ARRAY [0... 3] OF INT
The operation report can have the following values:
  • 16#00: No error.
  • 16#09: The socket number is invalid.
  • 16#23: No data to read.
  • 16#36: The connection has been reset by peer.
  • 16#39: The socket is not connected (listening socket).
  • 16#3C: The keep alive timed out on broken connection.
  • 16#0E: The length of the character string to be received is greater than 240 bytes.
The fourth word of the array should contain the number of bytes received if no error has occurred.