Share this page

# 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

Copy code

    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);
     }

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: