bluetooth

4 views
Skip to first unread message

HB

unread,
Apr 17, 2010, 8:51:44 AM4/17/10
to BLIP Protocol
Hi,

I'm using MYNetwork in a small game and I was delighted to find that
MYNetwork also works using bluetooth conections :-) Now I'm looking
for ways to improve the stability of the connection. I'm thinking
about a fixed number of reconnection tries if the connection uses
bluetooth or something like that. Since I'm a novice (at least as far
as networking code is concerned) I'd greatly appreciate hints oder
suggestions.

HB

--
BLIP-Protocol Mailing List
Options: <http://groups.google.com/group/blip-protocol?hl=en>
To unsubscribe, email <blip-protoco...@googlegroups.com>

Jens Alfke

unread,
Apr 17, 2010, 2:07:58 PM4/17/10
to HB, BLIP Protocol

On Apr 17, 2010, at 5:51 AM, HB wrote:

> I'm using MYNetwork in a small game and I was delighted to find that
> MYNetwork also works using bluetooth conections :-)

Um … it does?! That’s news to me — I never put in any code to handle Bluetooth. o_O

Is this on iPhone? The only thing I can imagine is that Apple modified the Bonjour implementation to do service discovery over Bluetooth, and made -[NSNetService getInputStream:outputStream:] create Bluetooth sockets instead of TCP ones. Huh. I’m pretty sure that’s not documented anywhere.

That’s good to hear, since it makes it more useful on iPhone in the absence of a nearby WiFi base station.

> Now I'm looking
> for ways to improve the stability of the connection. I'm thinking
> about a fixed number of reconnection tries if the connection uses
> bluetooth or something like that.

What are the specific stability problems you’re seeing?

—Jens

HB

unread,
Apr 21, 2010, 5:30:07 PM4/21/10
to BLIP Protocol
On Sat, Apr 17, 2010 at 8:07 PM, Jens Alfke <je...@mooseyard.com>
wrote:
>
> On Apr 17, 2010, at 5:51 AM, HB wrote:
>
>> I'm using MYNetwork in a small game and I was delighted to find that
>> MYNetwork also works using bluetooth conections :-)
>
> Um … it does?! That’s news to me — I never put in any code to handle Bluetooth. o_O
>
> Is this on iPhone? The only thing I can imagine is that Apple modified the Bonjour implementation to do service discovery over Bluetooth, and made -[NSNetService getInputStream:outputStream:] create Bluetooth sockets instead of TCP ones. Huh. I’m pretty sure that’s not documented anywhere.
>
> That’s good to hear, since it makes it more useful on iPhone in the absence of a nearby WiFi base station.
>

I'v looked through the documentation and the only reference I've found
is the readme of the "WiTap" example application.
http://developer.apple.com/iphone/library/samplecode/WiTap/Listings/ReadMe_txt.html
I didn't think that this readme file is the definitive reference, but
there you are ...

>> Now I'm looking
>> for ways to improve the stability of the connection. I'm thinking
>> about a fixed number of reconnection tries if the connection uses
>> bluetooth or something like that.
>
> What are the specific stability problems you’re seeing?

Hard to reproduce that at the moment because the trial happened at the
local pub using a friends iPhone. But my guess is that
- (void)connectionDidClose:(TCPConnection *)connection got called when
we increased the distance between the devices. Which can happen quite
easily if one user moves around the room etc. So I'm looking for an
automatic reconnection try. Is there a "best practive" to achieve
this? Is there a way to distinguish between deliberately closed
connections and accidentally closed connections? At the moment I
thinking about treating every closed connection as an accident if it
wasn't preceded by "willCloseConnection"-message.

HB
Reply all
Reply to author
Forward
0 new messages