国产探花免费观看_亚洲丰满少妇自慰呻吟_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成功,反之失敗
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 德令哈市| 瓦房店市| 霍林郭勒市| 井冈山市| 南皮县| 道孚县| 新绛县| 沭阳县| 武定县| 阿合奇县| 长汀县| 富蕴县| 西昌市| 军事| 海宁市| 浦北县| 惠东县| 六枝特区| 伊吾县| 乌苏市| 云安县| 宜阳县| 金川县| 东台市| 四会市| 盖州市| 乌鲁木齐市| 商丘市| 辽源市| 驻马店市| 乌恰县| 岑溪市| 天津市| 沧州市| 梁河县| 香港| 平利县| 林周县| 克拉玛依市| 常德市| 阿鲁科尔沁旗|