首页 > 编程 > .NET > 正文

PB使用WININET的FTP方式自动更新(二、判断是否可以连接)

2024-07-21 02:09:55
字体:
来源:转载
供稿:网友

global type f_connect_ftpserver from function_object
end type

forward prototypes
global function integer f_connect_ftpserver ()
end prototypes

global function integer f_connect_ftpserver ();
long ll_hret
long ll_hftp
integer li_ret = -1

do while yield()
loop

ll_hret = internetopena(gs_application_name,0,'','',0)
if ll_hret = 0 or isnull(ll_hret) then
  //messagebox('错误!','缺少动态连接库wininet.dll!',stopsign!)
 return li_ret
end if
ll_hftp = internetconnecta(ll_hret,gs_ftpserver1,gl_ftploginport1,gs_ftploginuser1,gs_ftploginpass1,1,0,0)
if ll_hftp = 0 then
  ll_hftp = internetconnecta(ll_hret,gs_ftpserver2,gl_ftploginport2,gs_ftploginuser2,gs_ftploginpass2,1,0,0)
 if ll_hftp = 0 then
  ll_hftp = internetconnecta(ll_hret,gs_ftpserver3,gl_ftploginport3,gs_ftploginuser3,gs_ftploginpass3,1,0,0)
  if ll_hftp = 0 then
   internetclosehandle(ll_hret)
   return li_ret
  else
   li_ret = 3
  end if
 else
  li_ret = 2
 end if
else
 li_ret = 1
end if
internetclosehandle(ll_hret)
internetclosehandle(ll_hftp)
return li_ret

end function

 
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表