receiveWait

Declaration

byte[] receiveWait(S7RClientSSjToken token) throws IllegalArgumentException.

Purpose

This method does a read from the input stream and returns the whole input data. The data is NOT translated and is in its wire form. If the timeout value is zero, then this method will wait until data is present or the connection is terminated. If the timeout value is not zero, then an exception is thrown if data is not received from the Substation ES in the specified number of milliseconds.
Note: If the first receiveWait data has a "ackRequired" flag on, then the next "receiveWait" call will automatically issue a "sendAck" if a previous "ack" or "nack" was not issued for this data and "autoAck" is true (autoAck by default is true).

Parameters

Parameter Description
token The S7RClientSSjToken returned by Connect method.

Return

This method returns byte[] object which is the wire data received. If a NULL response is returned, it means no data was received and needs to be checked.

Errors

  • IllegalArgumentException: This exception is thrown if there is a problem with the token or a timeout value is set and the method times out.

Example

S7RClientSSj conn = new S7RClientSSj();
S7RClientSSjToken token = conn.Connect(url, userid, password);
byte[] dataIn = conn.receiveWait(token);
if (dataIn != null)  processData(dataIn);
conn.Disconnect(token);