private void btn_Send_Click(object sender, EventArgs e)
{
//byte[] buffer = System.Text.Encoding.Unicode.GetBytes(this.txtbox_SendContent.Text);
int nRet = 0;
nRet = NetMessageBufferSend(null, txtbox_IP.Text, null, txtbox_SendContent.Text, txtbox_SendContent.Text.Length * 2 + 2);
}
[DllImport("Netapi32", CharSet = CharSet.Unicode)]
public static extern int NetMessageBufferSend(
string servername, //服务器名称,为NULL
string fromname, //接收方名称,可为IP或计算机名称
string msgname, //信息名称,为NULL
string buf, //信息
int buflen); //信息长度
信使服务模拟器
最新推荐文章于 2025-09-23 10:33:00 发布
本文介绍了一个使用C#实现的简单网络消息发送功能。通过调用NetMessageBufferSend函数,可以向指定IP地址发送文本信息。代码展示了如何设置服务器名称、接收方名称、信息名称及内容等参数。
1174

被折叠的 条评论
为什么被折叠?



