开发者

FTP upload problem

I have made a program to upload to my NAS via FTP protocol. My program runs fine when I try to upload to my web page, but when I开发者_开发问答 enter the IP of my NAS, the following line returns false:

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

What is the problem? Is the IP line wrong?


From the documentation for 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.


First make sure you can actually connect to the site with FileZilla or something.

Also, what happens if you just put the IP address without the leading "ftp"//" and the trailing "/media" ???

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜