Skip to main content
Version: v4 (Stable)

RECEIVESYNC

RECEIVESYNC(message AS STRING BYREF, SynchroStart As String [, SynchroEnd As String [, timeout AS INTEGER[, coding As INTEGER]]]) AS INTEGER

Waits for reception of a message during the maximum time of <timeout> milliseconds by checking the optional parameter <SynchroStart> and <SynchroEnd>.

Specify the waited message coding in the optional parameter <coding>: 0=ANSI (default value), 1=UNICODE, 2=Binary, 3=UTF8.

If the optional parameter <timeout> is null (default value), the function returns the current message without waiting.

If <timeout> is equal to -1, the function waits for the message without time limitation.

If a message is received, the function copies the message in the variable <message> and returns the length of the received message.

If no message is received after timeout, the function returns 0.

If the communication is aborted during wait, the function returns -1.

For IP connections, the function returns -2 when the socket is disconnected and the script continues to run.