哪位兄弟姐妹们用过基于udp协议的mina,能不能给老兄一个例子啊!

解决方案 »

  1.   

    package com.cusc.gcm.test;import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;import com.cusc.gcm.s2s.Endpoint;
    import com.cusc.gcm.s2s.EndpointFactory;
    import com.cusc.gcm.s2s.EndpointPacketFactory;public class S2SEndpointTest {private static Log log = LogFactory.getLog(S2SEndpointTest.class);public static void main(String[] args){
      
       log.info(" endpoint . ");   Endpoint server = EndpointFactory.createUDPClientEndpoint();
       server.start();  
       log.info(" endpoint . ");
       for(int i =0; i<10000; i++) {
        server.addPacket(EndpointPacketFactory.createAlarmParseSettingPacket());
       
        try {
         Thread.sleep(1000);
        } catch (InterruptedException e) {
         e.printStackTrace();
        }
       }}}