- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用了 OpenDDS 的 (DDS_HOME/tests/DCPS/Messenger) 发布者和订阅者示例。
在该源代码中,我只是更改了非常简单的代码。我想把消息放在 message.text
中.但是,它不起作用。实际上,当我第一次输入单词时,效果很好。但是,当我下一个输入单词时它不起作用。我认为这与内存分配问题有关。
那么,我该如何转换 char*
至 TAO::String_Manager_T<char>
类型?
这是我的部分源代码和错误信息:
Writer.cpp:
Messenger::Message message;
message.subject_id = 99;
DDS::InstanceHandle_t handle = message_dw->register_instance(message);
static struct sigaction act;
act.sa_handler=ctrlCfunc;
sigaction(SIGINT,&act,NULL);
/* We are all initialized, just service communications */
char userInput[255];
doIt=1;
message.from = "Comic Book Guy";
message.subject = "Review";
message.text = "Worst. Movie. Ever.";
message.count = 0;
while(doIt) {
fgets(userInput, sizeof(userInput), stdin);
userInput[sizeof(userInput)-1]='\0';
message.text=userInput;
DDS::ReturnCode_t error;
do {
error = message_dw->write(message, handle);
} while (error == DDS::RETCODE_TIMEOUT);
if (error != DDS::RETCODE_OK) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("%N:%l: svc()")
ACE_TEXT(" ERROR: write returned %d!\n"), error));
}
message.count++;
}
发布方错误:
# ./publisher -DCPSInfoRepo 210.107.212.75:12345 -DCPSConfigFile rtps_uni.ini
Starting publisher
(7352|140545985509184) NOTICE: using DCPSInfoRepo value from command option (overrides value if it's in config file).
Starting publisher with 1 args
(7352|140545985509184) WARNING: Could not find FQDN. Using "127.0.0.1" as fully qualified hostname, please correct system configuration.
Reliable DataWriter
Creating Writer
Starting Writer
testbug0
testbug1
*** Error in `./publisher': free(): invalid pointer: 0x00007fd35d37dcb0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fd3677427e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7fd36774b37a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7fd36774f53c]
/home/user/Desktop/OpenDDS-3.11/ACE_wrappers/lib/libTAO.so.2.2a_p12(_ZN5CORBA11string_freeEPc+0x2c)[0x7fd36878e1dc]
./publisher[0x4063dc]
./publisher[0x409f91]
./publisher[0x4094e7]
/home/user/Desktop/OpenDDS-3.11/ACE_wrappers/lib/libACE.so.6.2a_p12(_ZN13ACE_Task_Base7svc_runEPv+0x54)[0x7fd3683ccebc]
/home/user/Desktop/OpenDDS-3.11/ACE_wrappers/lib/libACE.so.6.2a_p12(_ZN18ACE_Thread_Adapter8invoke_iEv+0x113)[0x7fd3683cd52d]
/home/user/Desktop/OpenDDS-3.11/ACE_wrappers/lib/libACE.so.6.2a_p12(_ZN18ACE_Thread_Adapter6invokeEv+0xc7)[0x7fd3683cd3d1]
/home/user/Desktop/OpenDDS-3.11/ACE_wrappers/lib/libACE.so.6.2a_p12(ace_thread_adapter+0x2b)[0x7fd368338cb7]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7fd367a9c6ba]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7fd3677d23dd]
======= Memory map: ========
00400000-0040f000 r-xp 00000000 08:01 140986 /home/user/Desktop/OpenDDS-3.11/tests/DCPS/Messenger/publisher
0060e000-0060f000 r--p 0000e000 08:01 140986 /home/user/Desktop/OpenDDS-3.11/tests/DCPS/Messenger/publisher
0060f000-00610000 rw-p 0000f000 08:01 140986 /home/user/Desktop/OpenDDS-3.11/tests/DCPS/Messenger/publisher
00610000-00611000 rw-p 00000000 00:00 0
00667000-00787000 rw-p 00000000 00:00 0 [heap]
7fd33c000000-7fd33c022000 rw-p 00000000 00:00 0
7fd33c022000-7fd340000000 ---p 00000000 00:00 0
7fd344000000-7fd344022000 rw-p 00000000 00:00 0
7fd344022000-7fd348000000 ---p 00000000 00:00 0
7fd348000000-7fd348022000 rw-p 00000000 00:00 0
7fd348022000-7fd34c000000 ---p 00000000 00:00 0
7fd34c000000-7fd34c022000 rw-p 00000000 00:00 0
7fd34c022000-7fd350000000 ---p 00000000 00:00 0
7fd350000000-7fd350022000 rw-p 00000000 00:00 0
7fd350022000-7fd354000000 ---p 00000000 00:00 0
7fd354000000-7fd354022000 rw-p 00000000 00:00 0
订阅方错误:
# ./subscriber -DCPSConfigFile rtps_uni.ini
(9370|140579829053248) WARNING: Could not find FQDN. Using "127.0.0.1" as fully qualified hostname, please correct system configuration.
Transport is RELIABLE
Reliable DataReader
DataReaderListener.cpp:151: INFO: on_subscription_matched()
SampleInfo.sample_rank = 0
SampleInfo.instance_state = 1
ERROR: Repeat Message: subject = Review
subject_id = 99
from = Comic Book Guy
count = 0
text = testbug0
ERROR: Invalid message.text
最佳答案
我终于解决了我的问题。
我使用 message.text= CORBA::string_dup(userInput);
代替 message.text= userInput;
关于c++ - 如何稳定地将 char* 转换为 TAO::String_Manager_T<char>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45626677/
如果输入稳定,我想触发 AJAX 请求(以便不在每个新字符后发送请求)。我尝试了以下方法: $('#input').keyup(function(){ // Get the value when
我读到,我们可以插入以将选择排序更改为稳定排序,而不是交换。我在网上得到了以下相同的实现。 void selection ( int a[], int n ) { while ( --n >
我正在尝试创建一个非常节省空间的不寻常的关联数组实现,我需要一个满足以下所有条件的排序算法: 稳定(不改变具有等键的元素的相对顺序。) 就地或几乎就地(O(log n) 堆栈很好,但没有 O(n) 空
我有一个节点的无线网状网络,每个节点都能够向其邻居报告其“距离”,以(简化的)信号强度来衡量。节点在地理上位于 3d 空间中,但由于 radio 干扰,节点之间的距离不需要在三角(三角?)上一致。即,
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我正在实现一个玩具调度程序,它读取进程规范(例如到达时间、总运行时间)的输入文件,然后根据随机 io/cpu 突发调度进程。 文件格式 Arrival time, total CPU time, CP
我正在使用 JRedis 的同步实现,但我打算切换到异步方式与 Redis 服务器通信。 但在此之前我想问一下社区 JRedisFuture 是否实现了 alphazero 的 jredis对于生产使
我们正在为我们的公司构建一个RESTful API,它将提供XML,JSON和可能的其他内容类型。 我的团队正在寻找一个框架(按优先顺序排列): 有据可查 理想的情况下,它具有出色的教程以及繁荣的社区
我的网站希望用户上传他们的照片...但我该如何保护我们的服务器免受伤害?只允许 JPG 应该可以避免病毒问题,但如果有人选择 10Gb 文件怎么办 - 这会减慢整个网站的速度吗? 我们使用的是经典 A
关闭。这个问题需要更多 focused .它目前不接受答案。 想改进这个问题?更新问题,使其仅关注一个问题 editing this post . 8 个月前关闭。 Improve this ques
据我所知,paintEvent() 是在 QApplication 对象的“主循环”中执行的,并且可以为其内部系统任务花费时间,从而延迟执行排队槽或其他事件。 但是,如果我需要播放非常流畅的动画并且我
我想对随机排序的 ActiveRecord 模型列表(来自 MySQL 数据库的行)进行分页。 但是,这种随机化需要在每个 session 的基础上持续存在,以便访问该网站的其他人也会收到一个随机的、
在 Flutter Web 稳定后,我尝试按照文档中给出的说明将我的 Flutter Mobile 应用程序转换为 Flutter Web。一切都很好,但这里的问题是 Web 上的文本不可选择!我刚刚
我正在尝试制作一个包含 Nginx stable 最新使用 vts 模块编译的 dockerfile .... 我遇到了一个大问题,当我放入将下载的 docker 文件时我找不到一些汽车链接安装最新的
已结束。此问题正在寻求书籍、工具、软件库等的推荐。它不满足Stack Overflow guidelines 。目前不接受答案。 我们不允许提出寻求书籍、工具、软件库等推荐的问题。您可以编辑问题,以便
我正在使用以下命令将 Airflow 部署到 Kubernetes 中:https://github.com/helm/charts/tree/master/stable/airflow 我正在尝
我已经安装了本地测试elasticsearch和logstash,它们似乎看不到本地es-知道在集群/ ns中如何看到es吗? helm repo add elastic https://helm.e
我最近加入了一家公司,担任发布工程师,在这里,大量的开发团队以各种语言开发了众多服务,应用程序和Web应用程序,它们之间具有各种相互依赖性。 我正在尝试找到一种简化并最好自动发布的方法。当前,发布团队
已结束。此问题正在寻求书籍、工具、软件库等的推荐。它不满足Stack Overflow guidelines 。目前不接受答案。 我们不允许提出寻求书籍、工具、软件库等推荐的问题。您可以编辑问题,以便
我想知道一种在 Windows 上使用简单批处理和 ffmpeg 稳定 goPro 视频的简单方法。 最佳答案 1) 在您的计算机上安装 ffmpeg:按照 steps 安装 2) 在您要处理的视频旁
我是一名优秀的程序员,十分优秀!