我正在CouchbaseLite中使用CouchbaseListener进行点对点复制。我找不到同龄人。这是我遵循的代码,注意:这是所有的自我。属性是可用的
这里是我的侦听器代码
CBLManager *cblManager = [CBLManager sharedInstance];
self.dbListener = [[CBLListener alloc] initWithManager:cblManager port:0];
[self.dbListener setBonjourName:[[UIDevice currentDevice] name]
type:@"_ashok._tcp."];
[self.dbListener setTXTRecordDictionary:[NSDictionary dictionaryWithObject:DBNAME
forKey:@"dataBasePath"]];
NSError *error;
BOOL status = [self.dbListener start:&error];
if (status) {
dblPort = dbListener.port;
} else {
NSLog(@"CBLListener is not started: %@", error.localizedDescription);
}开始浏览对等点
self.serviceBrowser = [[NSNetServiceBrowser alloc] init];
self.serviceBrowser.includesPeerToPeer = YES;
self.serviceBrowser.delegate = self;
[self.serviceBrowser searchForServicesOfType:_ashok._tcp. inDomain:@"local."];
[self.serviceBrowser scheduleInRunLoop:[NSRunLoop currentRunLoop]
forMode:NSDefaultRunLoopMode];但我找不到同伴。我在两个设备上都打开了wifi和蓝牙。两者都没有连接到任何网络。
我测试过的情景:
在这两种情况下,我都找不到附近的同伴。
发布于 2014-09-12 19:56:10
在爬行了许多论坛之后,我刚刚在iOS上获得了对等方的工作。因此,我将只发布所有帮助我的东西(注意:为了简单起见,我将让侦听器运行的主机称为“服务器”,另一个称为“客户端”)。
希望这能帮上忙。一个非常有用的帮助您的线程:https://groups.google.com/forum/#!searchin/mobile-couchbase/p2p/mobile-couchbase/oFGn1zybDcE/7BE3vFXh9xoJ
https://stackoverflow.com/questions/21165878
复制相似问题