[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [dsdp-tcf-dev] Handling errors when opening a channel
|
Hi Ken,
The code is supposed to look like this:
channel = peer.openChannel();
channel.addChannelListener(new IChannel.IChannelListener() {
public void onChannelOpened() {
}
public void congestionLevel(int level) {
}
public void onChannelClosed(Throwable error) {
... handle Connection refused (and all other errors) here ...
}
});
Regards,
Eugene
________________________________
From: dsdp-tcf-dev-bounces@xxxxxxxxxxx
[mailto:dsdp-tcf-dev-bounces@xxxxxxxxxxx] On Behalf Of
ken.ryall@xxxxxxxxx
Sent: Thursday, April 30, 2009 3:19 PM
To: dsdp-tcf-dev@xxxxxxxxxxx
Subject: [dsdp-tcf-dev] Handling errors when opening a channel
I'd appreciate some advice on how to handle errors when opening a
channel. I'm calling IPeer.openChannel but in this case the peer has
shutdown and is no longer available.
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at org.eclipse.tm.tcf.core.ChannelTCP$1.run(ChannelTCP.java:70)
I've installed a ChannelOpenListener but that only tells you when it has
been opened, not when something goes wrong. I'm looking for the best
place to detect this. It looks like the channel gets terminated but I'm
not sure how to listen for that.
Thanks - Ken