Jmdns没有解决服务问题

时间:2014-03-07 12:00:00

标签: android jmdns

我按照JmDNS附带的示例。我的代码如下!

jmdns = JmDNS.create();
jmdns.addServiceListener("_nmx._tcp.local.",new ServiceListener() {

                            @Override
                            public void serviceResolved(ServiceEvent event) {
                                // TODO Auto-generated method stub
                                Log.e("called","serviceResolved");
                            }

                            @Override
                            public void serviceRemoved(ServiceEvent event) {
                                // TODO Auto-generated method stub

                            }

                            @Override
                            public void serviceAdded(ServiceEvent event) {
                                // TODO Auto-generated method stub
                                Log.e("called","serviceAdded");
                                Log.e("val:",event.getType()+":"+event.getName());
                                ServiceInfo info = event.getInfo();
                            //  Log.e("name",info.getHostAddress());
                                jmdns.requestServiceInfo(event.getType(), event.getName());

                            }
                        });
                    }

我从未看到"called serviceResolved"日志消息。但我看到service added日志消息。我还有什么办法来解决服务以获取主机的IP吗?

0 个答案:

没有答案