无法连接到 ftp 服务器
我正在尝试使用 Windows api 函数通过 powerbuilder 应用程序连接到 ftp 服务器。我设法通过 Internet Explorer 连接到 ftp 服务器(所以我不认为这是权限问题),但应用程序由于某种未知原因失败。
String ls_Null, &
ls_id
Integer li_rc
li_rc = 1
IF Not InternetAutodial(AUTODIAL_FORCE_UNATTENDED, 0) THEN
f_write_to_err_log('IMPORT Unable To Connect Internet - Dialup')
li_rc = -1
ELSE
SetNull(ls_Null)
ls_id = "Care_Dsend"
al_internet_handle = InternetOpen(ls_id, INTERNET_OPEN_TYPE_DIRECT, ls_Null, ls_Null, 0)
IF al_internet_handle > 0 THEN
al_ftp_connect_handle = InternetConnect(al_internet_handle, is_ftp_url, il_ftp_port, is_ftp_user, is_ftp_password, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, al_ref)
END IF
END IF
Return li_rc
//al_internet_handle, al_ftp_connect_handle are by ref long parms
//al_ref is a by ref unsignedlong parm
//is_ftp_url, is_ftp_user, is_ftp_password are strings
//il_ftp_port is long
该函数设法从 InternetOpen api 函数返回句柄,但从 InternetConnect 函数返回 0。
有什么想法吗?
I'm trying to connect to an ftp server through a powerbuilder application using windows api functions. I manage to connect to the ftp server through Internet Explorer (so I don't think it's a permission problem) but the application fails for some unknown reason.
String ls_Null, &
ls_id
Integer li_rc
li_rc = 1
IF Not InternetAutodial(AUTODIAL_FORCE_UNATTENDED, 0) THEN
f_write_to_err_log('IMPORT Unable To Connect Internet - Dialup')
li_rc = -1
ELSE
SetNull(ls_Null)
ls_id = "Care_Dsend"
al_internet_handle = InternetOpen(ls_id, INTERNET_OPEN_TYPE_DIRECT, ls_Null, ls_Null, 0)
IF al_internet_handle > 0 THEN
al_ftp_connect_handle = InternetConnect(al_internet_handle, is_ftp_url, il_ftp_port, is_ftp_user, is_ftp_password, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, al_ref)
END IF
END IF
Return li_rc
//al_internet_handle, al_ftp_connect_handle are by ref long parms
//al_ref is a by ref unsignedlong parm
//is_ftp_url, is_ftp_user, is_ftp_password are strings
//il_ftp_port is long
The function manages to return a handle from the InternetOpen api function, but returns 0 from the InternetConnect function.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,我知道问题出在哪里了。我在函数声明末尾缺少 ;Ansi ,如下所示:
Ok, I found out what the problem was. I was missing ;Ansi at the end of my function declaration as in :
您可以发布您的本地外部函数或您用于
InternetAutodial()
、InternetOpen()
等的任何函数吗?这些不是内置函数(至少在我的 Powerbuilder 11.2 中不是),而且它们看起来不像 PFC。另外,您使用的是哪个版本的 Powerbuilder。或者,您可能需要查看以下链接:
Can you post your Local External Functions or whatever you are using for
InternetAutodial()
,InternetOpen()
etc? Those are not built-in functions (at least not in my Powerbuilder 11.2) and they don't look like PFC. Also, what version of Powerbuilder are you using.Alternatively, you might want to look at these links: