3

我正在使用本地网络多人游戏进行 android 测验,主机应该向所有客户端发送消息。我正在使用这个NsdChat 示例。但是当我尝试重新爱上服务时,我得到了这个错误。

E/NsdServiceInfo: While parsing txt records (pos = 1): Zero sized txt record
E/NsdHelper: Resolve Succeeded. name: NsdChatHost, type: ._http._tcp, host: /"myIP", port: "myPort", txtRecord: 
E/NsdService: Unique id with no client mapping: 71
E/NsdService: Unhandled { when=-4ms what=393242 obj=com.android.server.NsdService$NativeEvent@157683e target=com.android.internal.util.StateMachine$SmHandler }

这是我的决心听众。

public void initializeResolveListener() {
        mResolveListener = new NsdManager.ResolveListener() {
            @Override
            public void onResolveFailed(NsdServiceInfo serviceInfo, int errorCode) {
                Log.e(TAG, "Resolve failed" + errorCode);
            }
            @Override
            public void onServiceResolved(NsdServiceInfo serviceInfo) {
                Log.e(TAG, "Resolve Succeeded. " + serviceInfo);
                if (serviceInfo.getServiceName().equals(mServiceName)) {
                    Log.d(TAG, "Same IP.");
                    return;
                }
                mService = serviceInfo;
            }
        };
    }
4

0 回答 0