jhwsr 2015-02-12 03:44 采纳率: 0%
浏览 2011

PB调用icmpcreatefile错误

在PB中调用icmpcreatefile()时错误error calling external function icmpcreatefile at line 16 in function wf_ping of object w_main

  • 写回答

2条回答 默认 最新

  • WorldMobile 2015-02-12 04:48
    关注

    如何在PB中编写PING代码?
    问题描述:
    如何在PB中编写PING代码?
    解决方案:
    声明外部函数:

    Function ulong IcmpCreateFile () Library "icmp.dll"
    Function long IcmpSendEcho (ulong IcmpHandle, ulong DestinationAddress, string RequestData,long RequestSize, long RequestOptions, Ref icmp_echo_reply ReplyBuffer, long ReplySize, long Timeout ) Library "icmp.dll" Alias for "IcmpSendEcho"
    Function long IcmpCloseHandle (ulong IcmpHandle) Library "icmp.dll"
    Function ulong inet_addr (string cp) Library "ws2_32.dll" Alias for "inet_addr"

    代码:

    ULong lul_address, lul_handle
    Long ll_rc, ll_size
    String ls_reply
    icmp_echo_reply lstr_reply

    lul_address = inet_addr(as_ipaddress)
    If lul_address > 0 Then
    lul_handle = IcmpCreateFile()
    ll_size = Len(as_echomsg)
    ll_rc = IcmpSendEcho(lul_handle, lul_address, &
    as_echomsg, ll_size, 0, &
    lstr_reply, 278, 200)
    IcmpCloseHandle(lul_handle)
    If ll_rc <> 0 Then
    If lstr_reply.Status = 0 Then
    ls_reply = String(lstr_reply.Data)
    If ls_reply = as_echomsg Then
    Return True
    End If
    End If
    End If
    End If

    Return False

    //True 表示PING成功,反之失败

    评论

报告相同问题?

悬赏问题

  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题