发表于:2003-01-01 10:20:00
楼主
各位前辈:
本人已经使用WIN98中的 CreateFile() 和 DeviceIoControl() 函数打开了
Lonworks 网络接口卡(PCLTA10)。
当我向其发送RESET命令时,可以成功。但本人想发出广播消息,发给网络中的
节点。(如果不行,请指出,如果可以,请看下面的代码)下面是本人的代码片段,
能帮我看看吗?
ni_msg->NiCmd =0x12; // ni_comm,using transaction queue.
ni_msg->Length = 16; //between 0 to 15
//MsgHdr
ni_msg->ExpAppBuffer[0] = 0x14;//message tag is zero,no auth,Unack,explicit message
ni_msg->ExpAppBuffer[1] = 0x1a;
ni_msg->ExpAppBuffer[2] = 0x01; //msg length 1
//ExplicitAddr
ni_msg->ExpAppBuffer[3] = 3;//broadcast
ni_msg->ExpAppBuffer[4] = 0x00;
ni_msg->ExpAppBuffer[5] = 0x31;
ni_msg->ExpAppBuffer[6] = 0x03;
ni_msg->ExpAppBuffer[7] = 0x00; //subnet zero.
ni_msg->ExpAppBuffer[8] = 0x00;
ni_msg->ExpAppBuffer[9] = 0x00;
ni_msg->ExpAppBuffer[10] = 0x00;
ni_msg->ExpAppBuffer[11] = 0x00;
ni_msg->ExpAppBuffer[12] = 0x00;
ni_msg->ExpAppBuffer[13] = 0x00;
ni_msg->ExpAppBuffer[14] = 0x01; //msg code
ni_msg->ExpAppBuffer[15] = 0x01;//msg data
msg_len = 18;
// Call function and write to a device
rc = ldv_write( *handle, (pVoid)ni_msg, msg_len );
//这里rc的返回值为零,说明写成功。
多谢 (2002圣诞夜)