无法连接到 ftp 服务器

发布于 2024-11-05 05:00:18 字数 1029 浏览 1 评论 0原文

我正在尝试使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

苏大泽ㄣ 2024-11-12 05:00:18

好吧,我知道问题出在哪里了。我在函数声明末尾缺少 ;Ansi ,如下所示:

函数 ulong InternetOpen(参考
字符串 lpszAgent, ulong dwAccessType,
参考字符串 lpszProxy,参考字符串
lpszProxyBypass、ulong dwFlags)
库“WININET.DLL”的别名
“InternetOpenA ;Ansi

Ok, I found out what the problem was. I was missing ;Ansi at the end of my function declaration as in :

Function ulong InternetOpen (ref
string lpszAgent, ulong dwAccessType,
ref string lpszProxy, ref string
lpszProxyBypass, ulong dwFlags)
Library "WININET.DLL" Alias for
"InternetOpenA ;Ansi"

橘和柠 2024-11-12 05:00:18

您可以发布您的本地外部函数或您用于 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:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文