你这个是检查IP地址的拼写是否有效,而没有测试IP地址是否通啊!你的程序关键的地方没有写程序。
if f_isipaddress(u_ipaddress) then
*在这个步骤怎么处理???
else
setprofilestring("ping.ini","properties","result","Ping Failure")
end if
string password_,password_hcy=""
long dw_address
dec dj[]
Constant String ver_old="2K3.11(20)"
//声明全局外部函数global ext fun
function ulong CreateMutexA (ulong lpMutexAttributes, int bInitialOwner, ref string lpName) library "kernel32.dll"
function ulong GetLastError () library "kernel32.dll"
Function long IcmpCreateFile() Library"icmp.dll"
Function long IcmpCloseHandle(ulong IcmpHandle)Library"icmp.dll"
Function long IcmpSendEcho(ulong IcmpHandle1,ulong DesAddress,string requestdata,long datasize,ulong requestoption,ref ICMP_ECHO_REPLY replybuffer,ulong Replysize,ulong timeout)Library"icmp.dll"
function int ShellAboutA( ulong al_hWnd, string as_szApp, string as_szOtherStuff, ulong hIcon ) library "shell32"
//声明结构
1、type icmp_echo_reply from structure
unsignedlong address
unsignedlong status
unsignedlong roundtriptime
unsignedlong datasize
unsignedlong reserved
unsignedlong datapointer
icmp_options options
string data
2、icmp_options from structure
character Ttl
character Tos
character Flags
character OptionsSize
character OptionsData
else
setprofilestring("ping.ini","properties","result","Ping Failure")
end if
long l_hPort
string s_DataToSend
long l_iOpt
ICMP_ECHO_REPLY echo
s_DataToSend="Send this characters"
long strlen
l_hport=0
strlen=len(s_datatosend)
l_hPort=IcmpCreateFile()
long rtn
rtn=0
dw_address=long(u_ipaddress)
rtn=IcmpSendEcho(l_hPort,dw_address,s_DataToSend,strlen,0,echo,56,200)
if rtn=1 then
//messagebox("Hello","Ping successful")
setprofilestring("ping.ini","properties","result","Ping Successful")
label1:
f_ping(STRING(f_ipaddressany('192.168.1.1')))
if ProfileString("ping.INI", "properties", "Result","None")="Ping Successful" then
//CONNECT USING SQLCA;
//if sqlca.sqlcode<>0 then
// messagebox("错误","能连通指定的IP地址,但远程服务器未提供数据服务~r~n"+sqlca.sqlerrtext+"~r~n~r~n远程服务器未启动或网络配置问题",StopSign!,RetryCancel!)
// HALT close
//else
w_logo.height=1593
sle_1.setfocus()
//end if
else
return_b=messagebox("错误","与中实运业IP地址通迅失败~r~n原因:①远程服务器关机~r~n ②网络太忙,稍后再试~r~n ③网络中断",StopSign!,RetryCancel!)
choose case return_b
case 1
goto label1
case 2
HALT close
end choose
end if