LrJposChannel.send
Sends a message over the channel.
public static void send(LrISOMsg message) throws IOException, ISOException, LrISOException
public static void send(byte[] bytes) throws IOException, ISOException
Parameters
Parameter | Description |
---|---|
message | The LrISOMsg instance to send through the channel. This is a high-level send: The function converts the message according to the packager, and sets headers and message length according to the channel. |
bytes | Array of bytes to send through the channel. This is a low-level send: Just the bytes are sent over the connection. |
Return values
This function does not return any values.
Example
public void simpleISOtest() throws Throwable{
GenericPackager packager = new GenericPackager(PACKAGERCONFIGFILE);
LrJposChannel.initChannel(LrJposChannel.ChannelType.ASCIIChannel, "localhost", 8000, packager);
LrJposChannel.connect();
LrISOMsg m = new LrISOMsg();
m.setMTI("0100");
m.set(ISO87Fields.PAN_PRIMARY_ACCOUNT_NUMBER, "1234567890000000000");
m.set(3, "523456");
m.set(4, "123456789121");
m.set(12, "20241605108110"); //Date and time - n-14, CCYYMMDDhhmmss
m.set(47, "32432");
LrJposChannel.send(m);
LrISOMsg r = LrJposChannel.receive();
if (r!=null) {
lr.output_message(r.getMTI());
}
LrJposChannel.disconnect();
LrJposChannel.closeChannel();
}