0

我制作了一个通过 FTP 协议上传到我的 NAS 的程序。当我尝试上传到我的网页时,我的程序运行良好,但是当我输入我的 NAS 的 IP 时,以下行返回 false:

HINTERNET MyhFtpSession = InternetConnect(MyhInternet, "ftp://89.xxx.xxx.xxx/media", INTERNET_DEFAULT_FTP_PORT, "MyUsername", "MyPassword", INTERNET_SERVICE_FTP, 0, 0);

问题是什么?IP线错了吗?

4

2 回答 2

0

首先确保您可以使用 FileZilla 或其他工具实际连接到该站点。

此外,如果您只输入 IP 地址而没有前导“ftp”//”和尾随“/media”,会发生什么?

于 2011-09-16T11:31:09.777 回答
0

从文档中InternetConnect()

Returns a valid handle to the session if the connection is successful, or NULL otherwise. To retrieve extended error information, call GetLastError(). An application can also use InternetGetLastResponseInfo() to determine why access to the service was denied.

In any case, the call is not returning false. Assuming you meant it returns NULL, then you need to call GetLastError() and/or InternetGetLastResponseInfo() to get the information. You can search for the meaning of the error code in the documentation on system error codes. If you post the result here, then we might be able to help you fix your problem.

于 2011-09-16T13:41:14.990 回答