can you post the code that is calling this?
-pete
class 1:
public class Start {
public static void main(String[] args) throws Exception {
System.out.println("runing");
ArrayList lst = new ArrayList();
Map row = new HashMap();
row.put("ip","192.168.100.69");
row.put("port",5001);
connect(row);
lst.add(row);
row.put("ip","127.0.0.1");
row.put("port",80);
connect(row);
lst.add(row);
} //method
public static void connect(Map arow) {
String ip = (String) arow.get("ip");
int port = (Integer) arow.get("port");
Pinger p = new Pinger();
p.ping( ip, port );
}// connect
}// class
class 2:
public class Pinger {
private final IoConnector _mConnector;
private final IoHandler _mHndlr= new IoHandlerAdapter();
public Pinger() {
_mConnector = new SocketConnector();
_mConnector.getDefaultConfig().setThreadModel( new
PooledThreadModel("client", 200)); //xxx: 500 a time??
((IoConnectorConfig)
_mConnector.getDefaultConfig()).setConnectTimeout(100); // 30 seconds
}
public void ping(String aip, int aport) {
ConnectFuture future= _mConnector.connect(new
InetSocketAddress(aip,aport), _mHndlr);
future.join();
try {
future.getSession(); // have session?
//XX bug here - if I unplug device for 10 seconds and then
plug in, it reports not ok - but should find.
//also, if one ping is taking a long time, it does not go on
to next.
System.out.println("OK"+aport);
} catch (Exception e) {
System.out.println("NOT_OK"+aport);
//e.printStackTrace();
}//try
}//()
}//class
tia,
.V