wupeter1 发表于 2009-8-25 15:37:26

求助:putq(mb)时弹出未处理异常

int TTcp::send(ACE_UINT32 ip, ACE_UINT16 port, unsigned int seq, const char* reqData, unsigned long int len)
{
ACE_Message_Block* mb = 0; // 数据包
ACE_NEW_RETURN(mb, ACE_Message_Block(sizeof(ACE_UINT32) + sizeof(ACE_UINT16) + sizeof(unsigned int) + sizeof(unsigned long int) + len, TCP_DATA_SEND), -1);

// 格式:ip | port | seq | len | 数据...
mb->copy((const char *)&ip, sizeof(ACE_UINT32));
mb->copy((const char *)&port, sizeof(ACE_UINT16));
mb->copy((const char *)&seq, sizeof(unsigned int));
mb->copy((const char *)&len, sizeof(unsigned long int));
mb->copy(reqData, len);
return this->putq(mb);
}
在另个类中调用该函数
std::string str1 = "requestData";
m_Tcp->send(ip, port, seq, str1.c_str(),str1.size());

上述函数执行到return时报错:Unhandled exception at 0x00466c3c (ACEd.dll) in CServer.exe: 0xC0000005: Access violation reading location 0x00000050.
然后跳到文件ACE_T .inl 中的template <ACE_SYNCH_DECL> ACE_INLINE int
ACE_Task<ACE_SYNCH_USE>::putq (ACE_Message_Block *mb, ACE_Time_Value *tv)
{
ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::putq");
return this->msg_queue_->enqueue_tail (mb, tv);
}

难道是putq的用法出错了吗?我在控制台程序上试没问题的啊,头大啊,大家帮帮忙吧。谢谢啦!!

winston 发表于 2009-8-25 16:21:41

代码太少,难以判断。多贴点代码上来。
页: [1]
查看完整版本: 求助:putq(mb)时弹出未处理异常