コード例 #1
0
ファイル: Server.java プロジェクト: hvram1/bankdemo
 public void run() {
   try {
     System.err.println(String.format("Parsing incoming: '%s'", new String(msg)));
     IsoMessage incoming = mfact.parseMessage(msg, 12);
     // Create a response
     IsoMessage response = mfact.createResponse(incoming);
     response.setField(11, incoming.getField(11));
     response.setField(7, incoming.getField(7));
     response.setValue(38, System.currentTimeMillis() % 1000000, IsoType.NUMERIC, 6);
     response.setValue(39, 0, IsoType.NUMERIC, 2);
     response.setValue(61, "Dynamic data generated at " + new Date(), IsoType.LLLVAR, 0);
     System.err.println("Sending response conf " + response.getField(38));
     response.write(sock.getOutputStream(), 2);
   } catch (ParseException ex) {
     log.error("Parsing incoming message", ex);
   } catch (IOException ex) {
     log.error("Sending response", ex);
   }
 }