gpt4 book ai didi

java - 是什么导致此错误 (java) : "Invalid memory access of location 0x0 rip=0x106282bae"

转载 作者:行者123 更新时间:2023-11-29 07:11:20 27 4
gpt4 key购买 nike

我正在为介绍性网络类(class)开发 P2P Twitter 客户端。我正在尝试为我的同龄人提供一种注册自己的方式,以便其他同龄人可以发现它。我正在创建一个 DNS TXT 记录,以便我可以调用 DNSSD.Register()。但是,当调用此方法时,我收到一条错误消息:

导致此错误的原因 (java):“位置 0x0 rip=0x106282bae 的无效内存访问”

这是导致它的方法:

import com.apple.dnssd.*;
public static void announce()throws com.apple.dnssd.DNSSDException{
TXTRecord txtRec = new TXTRecord();
txtRec.set("Version", "1.1");
txtRec.set("EncryptionSupport", "false");
txtRec.set("DisplayName", profile.getPropertyValue("UserName"));
txtRec.set("UserID", profile.getPropertyValue("UserID"));

RegisterListener myRegisterListener = null;
DNSSDRegistration reg = null;
RegisterListener myRegistrationListener = null;
reg = DNSSD.register
(0, DNSSD.ALL_INTERFACES, profile.getPropertyValue("UserName"),
profile.getPropertyValue("DNSSDServiceName"),
null, null, 4444, txtRec, myRegistrationListener);
}

“reg = ...”行是导致错误发生的行。关于我做错了什么的任何想法?其中很多摘 self 不完全理解的示例。

最佳答案

问题是 DNSSD.register() 方法的最后一个参数应该是一个有效的对象。由于您将它作为 NULL 指针传递,因此当它被调用时,您将获得对 0x0 位置的无效访问。

看看 docs对于这种方法。

关于java - 是什么导致此错误 (java) : "Invalid memory access of location 0x0 rip=0x106282bae",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13665828/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com