2012-11-02 97 views

回答

0

ISOServer作品與線程池,這樣你就可以接受開箱併發請求。每個套接字連接都由它自己的線程處理。所以,我認爲你所要做的就是爲你的ISOServer分配一個ISORequestListener來實際處理你的傳入消息。

下面是從初級專業人員指導採取了測試程序:

public class Test implements ISORequestListener { 
    public Test() { 
     super(); 
    } 

    public boolean process (ISOSource source, ISOMsg m) { 
     try { 
      m.setResponseMTI(); 
      m.set (39, "00"); 
      source.send (m); 
     } catch (ISOException e) { 
      e.printStackTrace(); 
     } catch (IOException e) { 
      e.printStackTrace(); 
     } 
     return true; 
    } 

    public static void main (String[] args) throws Exception { 
     Logger logger = new Logger(); 
     logger.addListener (new SimpleLogListener (System.out)); 
     ServerChannel channel = new XMLChannel (new XMLPackager()); 
     ((LogSource)channel).setLogger (logger, "channel"); 
     ISOServer server = new ISOServer (8000, channel, null); 
     server.setLogger (logger, "server"); 
     server.addISORequestListener (new Test()); 

     new Thread (server).start(); 

    } 
} 
相關問題