Download ScadaWorks Technical Reference Manual

Transcript
632
ScadaWorks Technical Reference Manual User's Guide
Parameters
sock: DINT Socket used for listening for a new connection and monitoring an established
connection.
Return Values
rslt: DINT
-2 invalid SOCK.
-1 = idle (no client connected).
0 = connected (client just connected).
1 = active (client still connected).
Remarks
ST Example
SockListen should be called and the status checked before every read and write of the
socket. SockListen will handle link status changes every time it is called.
SockListenResult := SockListen( Socket1Handle );
(* did we get a connection *)
if SockListenResult >= 0 then
(* go on and read or write from the connection *)
end_if;
Write Data To a Socket -- SockWrite()
Type
C Function
Function
Write data to an active connection.
FBD
Syntax
DINT SockWrite( DINT SOCK, STRING DATA, DINT SIZE )
Parameters
sock: DINT connection to write data to.
data: STRING data bytes to write
size: DINT number of data bytes to write.
Return Values
rslt: DINT
-2 = invalid SIZE (must be <= 255) or invalid SOCK.
-1 = no connection established.
0 = success (data written).
1 = blocked (retry call later until complete).