sockReceive (Functionblock)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

1.00 / 1.00.00


This function block reads data from the specified connection and will indicate when data is ready and placed into the receive buffer.

The data received will be available when indicated so by the "ready" output and until the next call to sockReceive.

 

 

Input:                

id : SINT

ID of the connection.

 

data : PTR

Address of the buffer that contains the received data.

 

maxsize : INT

Maximum number of bytes that can be received (size of "data").

 

Output:

ready : BOOL

True if data has been received

 

size : INT

Number of bytes received (if "ready" is true).

 

Declaration:

FUNCTION_BLOCK sockReceive;
VAR_INPUT
  id     : SINT; // ID of the connection.
  data   : PTR; // Address of receive buffer
  maxsize : INT; // Maximum number of bytes we can receive (size of 'data')
END_VAR;
VAR_OUTPUT
  ready   : BOOL; // data is ready
  size   : INT;  // Number of bytes received
END_VAR;

 

 


Example:

 

Please see the "Examples - Socket Communication"