Re: RFCOMMClient and Server Examples
Re: RFCOMMClient and Server Examples
- Subject: Re: RFCOMMClient and Server Examples
- From: Eric Brown <email@hidden>
- Date: Wed, 18 Sep 2002 11:44:54 -0700
On Wednesday, September 18, 2002, at 03:34 AM, Keith Phu wrote:
Has anyone gotten the RFCOMMServer and RFCOMMClient example code to
work?
I can start the server, and the 'chat server' service is visible on
the client side. But when I try to select the 'chat server' service,
no connection is made. After a day of debugging I think I've narrowed
down my problem. I think the server software isn't detecting the
incoming RFCOMM Channel being set up by the client.
Stepping through the client code, the client is stalling on the
following line.
if ((result == kIOReturnSuccess) &&
(IOBluetoothDeviceOpenRFCOMMChannel(connectToDevice ,rfcommChannelID,
&rfcommChannel) == kIOReturnSuccess))
{
which led me to believe that the server is not registering an incoming
data listener.
Now looking through the server code, it appears that it registers an
incoming data listener in the newRFCOMMChannelOpened function. This
function is supposed to be called automatically when an incoming
channel is detected. It's setup in the following line
incomgingChannelNotification =
[IOBluetoothRFCOMMChannel registerForChannelOpenNotifications:self
selector:@selector(newRFCOMMChannelOpened:)
withChannelID:serverChannelID
direction:kIOBluetoothUserNotificationChannelDirectionIncoming];
This line is the problem. There was a change in the way that channel
open notifications work made between the preview release and Jaguar.
A change is needed in the @selector() passed to the register method.
The line should read:
incomgingChannelNotification = [IOBluetoothRFCOMMChannel
registerForChannelOpenNotifications:self
selector:@selector(newRFCOMMChannelOpened:channel:)
withChannelID:serverChannelID
direction:kIOBluetoothUserNotificationChannelDirectionIncoming];
The sample will be fixed in a future release.
Using BluetoothMonitor, I can see that an RFCOMM channel does in fact
exist. So I think that the handler (newRFCOMMChannelOpened:) is not
being called when an incoming channel event occurs.
But, I don't know what to do about it. Does anyone have any ideas?
Even if the example code worked perfectly for you without
modifications, I'd like to know.
Thanks
Keith
- Eric
_______________________________________________
bluetooth-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/bluetooth-dev
Do not post admin requests to the list. They will be ignored.