国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

如何在PB中編寫PING代碼?(改編)

2024-07-21 02:09:57
字體:
來源:轉載
供稿:網友


如何在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成功,反之失敗
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 张掖市| 桦川县| 唐河县| 鄂伦春自治旗| 万源市| 甘南县| 西宁市| 河曲县| 五原县| 原阳县| 房产| 馆陶县| 斗六市| 方城县| 佛坪县| 夏邑县| 盐津县| 天祝| 南澳县| 吴忠市| 喀什市| 琼中| 晋州市| 长春市| 绥中县| 土默特左旗| 龙江县| 丰宁| 绵阳市| 竹溪县| 阿荣旗| 新丰县| 阿勒泰市| 墨竹工卡县| 娱乐| 洮南市| 深水埗区| 光泽县| 常德市| 邹平县| 高安市|