一.服务端
1、创建NSNetService对象:

2、发布服务



3、使用socket监听



这里使用俩个NSDictionary对象将socket设备和设备信息存储起来,为了host发生变化,使用host作为设备key,之后可以结合心跳信息区分设备被挤掉线的情况




1、创建NSNetService对象:
2、发布服务
3、使用socket监听
这里使用俩个NSDictionary对象将socket设备和设备信息存储起来,为了host发生变化,使用host作为设备key,之后可以结合心跳信息区分设备被挤掉线的情况
本文标题:iOS、macOS基于Bonjour、CocoaAsyncSoc
本文链接:https://www.haomeiwen.com/subject/agjpqltx.html
网友评论