Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Cannot connect to FTP Server.

Cannot connect to FTP Server.

Scheduled Pinned Locked Moved C / C++ / MFC
comsysadmin
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sameerkumar Namdeo
    wrote on last edited by
    #1

    Hi, I am trying to access files on ftp server using Wininet Apis. 1. I am accessing internet through proxy server. 2. There is a ftp server which gives only read access. when I am using following string in URL to access ftp server , I can see the file/ folders on ftp server i.e connection successful. string:-> ftp://username:password@xyz.com but I cannot establish ftp session through Wininet APIs. hInetOpen=InternetOpen(_T("ProxyTest"), INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); InternetSetOption(hInetOpen, INTERNET_OPTION_PROXY_USERNAME, strUsername, _tcslen(strUsername)+1); InternetSetOption(hInetOpen, INTERNET_OPTION_PROXY_PASSWORD, strPassword, _tcslen(strPassword)+1); hInetConnect=InternetConnect(hInetOpen, _T("xyz.com"), INTERNET_INVALID_PORT_NUMBER, _T("username"), _T("password"), INTERNET_SERVICE_FTP,INTERNET_FLAG_PASSIVE ,0); I am getting hInetConnect = NULL. Please specify where I am getting wrong or any extra things need to be executed. Regards, Sameer.

    S 1 Reply Last reply
    0
    • S Sameerkumar Namdeo

      Hi, I am trying to access files on ftp server using Wininet Apis. 1. I am accessing internet through proxy server. 2. There is a ftp server which gives only read access. when I am using following string in URL to access ftp server , I can see the file/ folders on ftp server i.e connection successful. string:-> ftp://username:password@xyz.com but I cannot establish ftp session through Wininet APIs. hInetOpen=InternetOpen(_T("ProxyTest"), INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); InternetSetOption(hInetOpen, INTERNET_OPTION_PROXY_USERNAME, strUsername, _tcslen(strUsername)+1); InternetSetOption(hInetOpen, INTERNET_OPTION_PROXY_PASSWORD, strPassword, _tcslen(strPassword)+1); hInetConnect=InternetConnect(hInetOpen, _T("xyz.com"), INTERNET_INVALID_PORT_NUMBER, _T("username"), _T("password"), INTERNET_SERVICE_FTP,INTERNET_FLAG_PASSIVE ,0); I am getting hInetConnect = NULL. Please specify where I am getting wrong or any extra things need to be executed. Regards, Sameer.

      S Offline
      S Offline
      san123pune
      wrote on last edited by
      #2

      I think you should put 21 instead of INTERNET_INVALID_PORT_NUMBER :-D

      S 1 Reply Last reply
      0
      • S san123pune

        I think you should put 21 instead of INTERNET_INVALID_PORT_NUMBER :-D

        S Offline
        S Offline
        Sameerkumar Namdeo
        wrote on last edited by
        #3

        when INTERNET_SERVICE_FTP is used in InternetConnect that time INTERNET_INVALID_PORT_NUMBER is taken as 21. Is there any other issue that needs to be looked into?

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups