jdiehl / async-network

Cocoa and iOS Socket Networking Evolved
http://jdiehl.github.com/async-network
MIT License
91 stars 31 forks source link

Bluetooth Support #5

Closed willSapgreen closed 9 years ago

willSapgreen commented 9 years ago

Hello Jonathan, It does not work when using AsyncServer and AsyncClient through Bluethooth( it works through WiFi ). Then I found the following links about in order to through Bluetooth, includesPeerToPeer property sets to TRUE on NSNetService(AsyncServer) and NSNetServiceBrowser(AsyncClient). However, after setting this property before AsyncClient start or AsyncServer start, the devices still cannot see each other. Can you take a look if available?

The links: https://developer.apple.com/library/ios/qa/qa1753/_index.html https://developer.apple.com/library/ios/documentation/Networking/Conceptual/NSNetServiceProgGuide/Articles/PublishingServices.html

Thank you for helping.

jdiehl commented 9 years ago

I am running into the same problem you are but don't really know how to fix it. If you make any progress, please let me know so I can include it in the framework. Sorry for not being able to help you.

willSapgreen commented 9 years ago

The following changes work for iOS 8.2, but not sure for other platforms:

In AsyncServer::setupNetService, add _netService.includesPeerToPeer = YES; before self.netService.delegate = self;

In AsyncClient::start, add _serviceBrowser.includesPeerToPeer = YES; before [self.serviceBrowser setDelegate:self];

Please let me know if any problem.

Another potential issue is AsyncClient will still connect to AsyncServer automatically even if setting autoConnect to FALSE. Would you mind to take a look at this issue?

Thank you so much for helping.

jdiehl commented 9 years ago

I added the property includesPeerToPeer to both AsyncClient and AsyncServer

jdiehl commented 9 years ago

I just verified that setting client.autoConnect = YES does prevent the automatic connection as it should. However, the flag is overridden if the delegate method is implemented and returns YES.

willSapgreen commented 9 years ago

Thanks for the quick response. For autoConnect, which delegate method do you mean? Thank you for helping.

jdiehl commented 9 years ago

Sent from my iPhone

On 30 Mar 2015, at 19:30, willSapgreen notifications@github.com wrote:

Thanks for the quick response. For autoConnect, which delegate method do you mean? Thank you for helping.

— Reply to this email directly or view it on GitHub.