请问下面这段代码有什么错误

shilei7777 2003-12-30 09:52:17
smiLPUINT32 MajorVersion;
smiLPUINT32 nMinorVersion;
smiLPUINT32 nLevel;
smiLPUINT32 nTranslateMode;
smiLPUINT32 nRetransmitMode;
HSNMP_SESSION hSession;
HSNMP_ENTITY hSendEntity;
HSNMP_ENTITY hReEntity;
HSNMP_CONTEXT hContext;

smiLPOID smiOid;
HSNMP_VBL hVbl;
HSNMP_PDU hPdu;
MajorVersion=new unsigned long;
nMinorVersion=new unsigned long;
nLevel=new unsigned long;
nTranslateMode=new unsigned long;
nRetransmitMode=new unsigned long;
if(SnmpStartup(MajorVersion,nMinorVersion,nLevel,nTranslateMode,
nRetransmitMode) != SNMPAPI_SUCCESS)
{
AfxMessageBox("SnmpStatup Error");
}


hSession = SnmpCreateSession(m_hWnd,wMsg,NULL,NULL);
if(hSession == SNMPAPI_FAILURE)
{
AfxMessageBox("SnmpCreateSession Error");
}
if(SnmpSetTranslateMode(SNMPAPI_UNTRANSLATED_V2) != SNMPAPI_SUCCESS )
{
AfxMessageBox("SnmpSetTranslateMode Error");
}

smiOCTETS smiOctets;
smiOctets.len = lstrlen("public");
smiOctets.ptr = (unsigned char *)"public";
hContext = SnmpStrToContext(hSession, &smiOctets);
if(hContext == SNMPAPI_FAILURE)
{
AfxMessageBox("hContext Error");
}

hSendEntity = SnmpStrToEntity(hSession,"10.0.0.4");
if(hSendEntity == SNMPAPI_FAILURE)
{
AfxMessageBox(" hSendEntity SnmpStrToEntity Error");
}
hReEntity = SnmpStrToEntity(hSession,"10.0.0.3");
if(hReEntity == SNMPAPI_FAILURE)
{
AfxMessageBox("hReEntity SnmpStrToEntity Error");
}
if(SnmpSetTimeout(hSendEntity,10) == SNMPAPI_FAILURE)
{
AfxMessageBox("SnmpSetTimeout Error");
}
if(SnmpSetRetry(hSendEntity,20) == SNMPAPI_FAILURE)
{
AfxMessageBox("SnmpSetRetry Error");
}
smiOid = new smiOID;
if(SnmpStrToOid("1.3.6.1.2.1.33.1.6.2.1.2.0",smiOid) == SNMPAPI_FAILURE)
{
AfxMessageBox("SnmpStrToOid Error");
}

hVbl = SnmpCreateVbl(hSession,smiOid,NULL);
if(hVbl == SNMPAPI_FAILURE)
{
AfxMessageBox("SnmpCreateVbl Error");
}
hPdu = SnmpCreatePdu(hSession,SNMP_PDU_GET,5,NULL,NULL,hVbl);
if(hPdu == SNMPAPI_FAILURE)
{
AfxMessageBox("SnmpCreatePdu Error");
}
if(SnmpSendMsg(hSession,NULL,hSendEntity,hContext,hPdu) == SNMPAPI_FAILURE)
{
AfxMessageBox("SmpSendMsg Error");
}
...全文
33 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
shilei7777 2004-01-02
  • 打赏
  • 举报
回复
编译通过没有错误
sboom 2003-12-30
  • 打赏
  • 举报
回复
你试试编译,看有什么报告先。

18,355

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 网络编程
c++c语言开发语言 技术论坛(原bbs)
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧