[JXTA discuss] Finding a broken JxtaSocket connection

Horacio Sanson <[email protected]> Wed, 6 Jul 2005 13:57:33 +0000
Newsgroups gmane.comp.java.jxta.general
Organization MMLab
Message-ID <[email protected]>
I have this little app where two peers get a connection via JxtaSocket. I get 
the connection working and I can tranfer an Ogg Audio stream from one node to 
the other without problems.

My problem is that if for some reason one of the peers goes down unexpectly, 
the other one does not find out until is too late.

This is a streaming application, a source peer starts a streaming session and 
starts sending audio packets, my client peer finds the session and the 
JxtaServerSocket of the source peer (via Jxta Service) and connects to it or 
any other peer already listening the streaming session.

If the source peer dies, my client peer should find out quickly and try to 
connect to another peer that has the streaming data before the audio buffer 
runs off. The problem is thatthe client peer doesnt know the source peer is 
down, the JxtaSocket connection keeps on until a read time out exception pops 
up and by that time the client audio buffer is empty and the streaming flow 
breaks.

In the same manner if the client peer dies, the source peer that was serving 
it does not find out and cannot release the resources to allow other client 
peers connections. It keeps sending audio packets to the client peer even 
thought the client is not there anymore.


How can I find out if any of the two sides involved in a JxtaSocket connection 
is no longer there so I can take proper actions?


thanks,
Horacio