getReturnCode

Declaration

int getReturnCode(S7RClientSSjToken token).

Purpose

This method gets ReturnCode value from the previously received message in the current buffer. Normally this is zero. If ReturnCode is not zero, then a problem is indicated from the Substation ES side. Look at ReasonCode, Id and DataContent for more information on what the error is.

Parameters

Parameter Description
token The S7RClientSSjToken returned by Connect method.

Return

The method returns an int with the value of "ReasonCode" in the S7R data.

Example

S7RClientSSj conn = new S7RClientSSj();
S7RClientSSjToken token = conn.Connect(url, userid, password);
conn.setAutoAck(token, false); // user will handle ack/nack process
conn.setTimeout(token, 10*1000); // set 10 second timeout on gets
byte[] dataIn = conn.receiveWait(token);
if (dataIn != null && conn.getReturnCode(token) == 0) {
process dataIn
}
conn.Disconnect(token)