Re: Bluetooth Driver
Roger <[email protected]> Sat, 17 May 2008 19:21:33 +0200
| Newsgroups | gmane.comp.java.sun.kvm |
|---|---|
| Message-ID | <[email protected]> |
Just split up your exception handling (what do you mean by "valid
exception"?). Once you catch a SocketException (or similar), you
shouldn't have any problems with categorizing the problem.
Another tipp: let em ping frequently. Bluetooth connections aren't as
stable as usual socket connections for some particular reasons, that are
plain to see. So the exception might be thrown before the trouble raises
and you even might reconnect in time.
I highly appreciate writing a very sophisticated Connection (-Pool)
Manager since Bluetooth surprises in several cases. Keep in mind, that
there are lots of different BT stacks. E.g. a Widcomm stack works
completely different from BlueZ asf..
Best,
Roger
Chris Rotberg schrieb:
> I am writing a Bluetooth driver and am trying to implement auto
> reconnect, I can sucessfully connect and disconnect. I want to have
> the application auto connect if the connection is dropped. I have
> listeners that raise events for open
>
> streamConn = (StreamConnection)Connector.open("btspp://" + address);
>
> but once the connection is open how can I detect if the connection is
> dropped? I could add a exception handler on read() but there could be
> a valid exception and I can not assume that an exception is a dropped
> connection. Is there a way to detect if the StreamConnection is closed?
>
> Thanks
> ===========================================================================
> To unsubscribe, send email to [email protected] and include in the
> body of the message "signoff KVM-INTEREST". For general help, send
> email to [email protected] and include in the body of the message
> "help".
--
/**************************
* Roger F. Hösl
* Engelthaler Str. 5
* 60435 Frankfurt
* Fon: (069) 79202638
* Mobil: 0172 1409984
* Fax: (069) 79202978
* Mail: [email protected]
**************************/
===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
[email protected] and include in the body of the message "help".