Tag: 多播

通过GCDAsyncUdpSocket发送多播UDP失败,Wireshark中没有任何活动

它适用于任何已知的IP,如下所示: [udpSocket sendData:datatosend toHost:@"192.168.1.113" port:port withTimeout:-1 tag:0]; 但是,当我试图使用宽带多播,没有logging,什么都没有发生 [udpSocket sendData:datatosend toHost:@"192.168.1.255" port:port withTimeout:-1 tag:0]; 接收作品好吧,我也试过255.255.255.255 – 相同。 它不会给出任何错误。

如何使用GCDAsyncUdpSocket通过wifi和蓝牙进行组播

我目前使用GCDAsyncUdpSocket在iOS设备之间通过wifi发送多播数据报。 守则很简单.. 客户 self.socket = [[GCDAsyncUdpSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_main_queue()]; //omitted error checking [self.socket bindToPort:12345 error:&err]; [self.socket joinMulticastGroup:@"224.0.1.1" error:&err]; [self.socket beginReceiving:&err]; 服务器 self.multicastSocket = [[GCDAsyncUdpSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_main_queue()]; NSData *d = [@"hello" dataUsingEncoding:NSUTF8StringEncoding]; [self.multicastSocket sendData:d toHost:@"224.0.1.1" port:12345 withTimeout:-1 tag:11]; 这工作得很好,无线networking。 我如何使它通过蓝牙工作呢? 我GOOGLE了一堆,找不到任何东西…我需要创build两个单独的套接字? 一个绑定到wifi接口,另一个绑定到蓝牙接口? 编辑:还是我困惑的东西根本? 这一定是可能的。 GameKit的GKSession完全是这样的,对吧?

iOS上的GCDAsyncUdpSocket丢失了多播数据报

我有一个networking上的设备,通过UDP组播一个非常小的文件。 我正在开发的iOS应用程序负责读取这些数据包,我select使用GCDAsyncUdpSocket来做到这一点。 该文件每半秒发送一次,但我几乎没有收到它(往往每3-10秒接收一次)。 考虑到这可能是设备的问题,我开始使用Wireshark监控stream量。 这似乎反映了我在应用程序中看到的内容,直到我在Wireshark中启用“Monitor Mode”为止,此时每个UDP数据包都被捕获。 此外,iOS模拟器开始接收所有丢失的数据包,因为它与我正在开发的Mac共享网卡。 有没有办法在iOS设备上启用“监视器模式”,或者我缺less一些可以丢失数据包的东西? 我也看到在GCDAsyncUdpSocket中有一个readStream方法。 也许我需要使用这个而不是beginReceiving? 尽pipe如此,我不知道如何在Objective-C中设置stream。 这是我现在的testing代码: – (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. NSLog(@"View Loaded"); [self setupSocket]; } – (void)setupSocket { udpSocket = [[GCDAsyncUdpSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_main_queue()]; NSError *error = nil; if (![udpSocket bindToPort:5555 error:&error]) { NSLog(@"Error binding […]