LrJposChannel.receive
Receives a message over the channel.
public static LrISOMsg receive() throws IOException, ISOException
public static LrISOMsg receive(int seconds) throws IOException, ISOException
Parameters
seconds: The number of seconds to wait for the response.
Return values
This function returns an LrISOMsg over the connection.
If a timeout is defined, and no message is received after waiting the defined number of seconds, it returns null.
Example
public void binary2003() throws Throwable{
lr.start_transaction("NormalSendReceiveMessages");
//system.out logger
Logger logger = new Logger();
logger.addListener(new SimpleLogListener(System.out));
LrJposChannel.setLogger(logger, "log");
LrJposChannel.connect();
//read message from file
LrISOMsg msg= new LrISOMsg();
msg.setPackager(new XMLPackager());
InputStream stream = new FileInputStream("message1.xml");
msg.unpack(stream);
for (int i=1; i<8; i++) {
msg.set(11, createMessageTrace(i));
LrJposChannel.send(msg);
LrISOMsg r = LrJposChannel.receive(5);
}
lr.end_transaction("NormalSendReceiveMessages", lr.AUTO);
}