Thread: InternetConnect() error, resolving name

  1. #1
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401

    InternetConnect() error, resolving name

    I'm trying to connect to an FTP server, but I am getting the error ERROR_INTERNET_NAME_NOT_RESOLVED. Using the exact same address, username, and password, I can log in using IE. Here is my code:

    Code:
    hNet=InternetOpen("ipupdate",INTERNET_OPEN_TYPE_DIRECT,
                           NULL,NULL,NULL);
    hFTP=InternetConnect(hNet,"ftp://members.optushome.com.au",
                    INTERNET_DEFAULT_FTP_PORT,
                    "username","password",INTERNET_SERVICE_FTP,
                    NULL,NULL);
    InternetOpen() returns a valid handle, but InternetConnect() returns NULL. Is there anything in the function calls that would cause this error?
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Well "ftp://members.optushome.com.au" is protocol_name://domain_name, which IE uses to decide which protocol to use.

    Since you're already set on using FTP, try it without the "ftp://" bit
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    I could kiss you right now Salem, it works perfectly. Thank you.
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. InternetConnect fails
    By jmd15 in forum Windows Programming
    Replies: 5
    Last Post: 09-04-2005, 06:05 PM
  2. wininet (internetconnect)
    By jabroni77 in forum Networking/Device Communication
    Replies: 0
    Last Post: 05-19-2005, 07:29 AM