我正在研究这几个月,但我的iPhone拒绝发现我的Java(或Android)应用程序。我找到了适用于Android(AirPin)的接收器应用程序,它可用,我用它来与我的代码进行比较。
我正在使用最新的jmdns源代码构建。
private final static int PORT = 46667;
private static String DNSSD_TYPE = "_airplay._tcp.local.";
public static void main(String[] args) {
Map<String, String> map = new LinkedHashMap<String, String>();
map.put("features", "0x2a7f");
map.put("deviceid", "33:00:18:7A:FE:A1");
map.put("model", "AndroidTV2,1");
map.put("srcvers", "130.14");
String name = "ITV@133";
ServiceInfo info = ServiceInfo.create(DNSSD_TYPE, name, PORT, 0, 0,
true, map);
try {
JmDNS jmdns = JmDNS.create();
jmdns.registerService(info);
for (ServiceInfo s : jmdns.list(DNSSD_TYPE, 1000))
System.out.println(s+" "+s.getPriority()+" "+s.getWeight());
} catch (Exception e) {
e.printStackTrace();
}
}
此代码返回(我是133):
[ServiceInfoImpl@2048166867 name: 'ITV@133._airplay._tcp.local.' address: '/192.168.1.107:46667 ' status: 'DNS: pauls-mbp.local. state: probing 1 task: null' is persistent, has data
model: AndroidTV2,1
deviceid: 33:00:18:7A:FE:A1
features: 0x2a7f
srcvers: 130.14
] 0 0
[ServiceInfoImpl@930501550 name: 'ITV@139._airplay._tcp.local.' address: '/192.168.1.139:46667 ' status: 'DNS: pauls-mbp.local. state: probing 1 task: null' is persistent, has data
model: AndroidTV2,1
features: 0x2a7f
deviceid: 00:11:7F:54:DF:0B
srcvers: 130.14
] 0 0
正如你所看到的,似乎我们是相同的,但我的iPhone没有发现我的服务,而另一个是。
有谁知道如何解决这个问题?