Hopefully I am getting closer.
If I unplug ip device for 10 seconds, start program and then plug in, it
reports not ok - but should find it since time out is 100.
Also, if one ping is taking a long time, it does not go on to next, as I
call ping mutiple times.
.V
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();
}
}
Trustin Lee wrote:
On 6/28/06, netsql <[EMAIL PROTECTED]>
wrote:
Yes, so I should not use the handler?
Just create 500 "connectors" w/ try catch block ?
And if so, should each of the 500 connectors be in a endless loop?
You can reuse one connector instance and call connect() method many times.
Trustin