在使用setText()为ServiceInfo添加地图并进行进一步注册后,JmDNS无法看到其他服务,例如:
private final String TYPE = "_http._tcp.local.";
private final String SERVICE_NAME = "Client";
private final int PORT = 49152;
private JmDNS jmDNS;
private ServiceInfo mServiceInfo;
private ServiceListener mServiceListener;
jmDNS = JmDNS.create(getCurrentInetAddress());
mServiceInfo = ServiceInfo.create(TYPE, SERVICE_NAME, PORT, SERVICE_NAME);
Map<String, String> serviceInfoMap = new LinkedHashMap<String, String>(){{
put(serviceInfoTags.TYPE_TAG.toString(), deviceTypes.PHONE.toString());
put(serviceInfoTags.DEVICE_NAME_TAG.toString(), DEVICE_NAME);
}};
mServiceInfo.setText(serviceInfoMap);
jmDNS.registerService(mServiceInfo);
在发现时,他看到了自己,但使用此方法的其他人则没有。 如何解决?
有关...