Download ScadaWorks Technical Reference Manual

Transcript
Section XXIV ISaGRAF Function and Function Blocks 635
Read Data From a Socket -- SockRead()
Type
C Function Block
Function
Read data from an established connection
FBD
Syntax
SockRead( DINT SOCK, DINT MAX )
SockRead.rslt
SockRead.size
SockRead.data
Parameters
sock: DINT connection to read data from.
max: DINT maximum number of byte to read from connection.
Return Values rslt: DINT
-2 = invalid max SIZE (must be <= 255) or invalid SOCK.
-1 = no connection established.
0 = success (data available).
1 = blocked (no data available).
data: DINT data bytes read (STRING).
size: DINT number of data bytes read.
Remarks
Read data from an established socket and place it in the DATA output string.
SockConnect or SockListen should be called and the status checked before every read and
write of the socket.
If using SockConnect in structured text, you must declare a function block instance in the
ISaGRAF dictionary.