欢迎光临
我们一直在努力

如何在PB中编写PING代码?(改编)-数据库专栏,其他相关

建站超值云服务器,限时71元/月

如何在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成功,反之失败

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 如何在PB中编写PING代码?(改编)-数据库专栏,其他相关
分享到: 更多 (0)

相关推荐

  • 暂无文章