Solved

WinInet exception - help !

Posted on 1998-08-21
3
1,266 Views
Last Modified: 2013-11-20
I am programming an ActiveX control in which I call the WinInet class CInternetFile - see code below :

BOOL CWebctlCtrl::GetConfigData(LPCTSTR szURL)
{
// TODO: Add your dispatch handler code here
CInternetSession session("My FTP Session");
CInternetFile *pIF;
DCEDATA dce;
CFtpConnection* pConn = NULL;
char buf[30];

AfxMessageBox(szURL);
pConn = session.GetFtpConnection((LPSTR) szURL, NULL, NULL, 80  );//get the file
      
lstrcat((char *) szURL,"//dce-data.dat");
pIF = pConn->OpenFile((LPSTR) szURL); // defaults used
pIF->Read((DCEDATA *) &dce, sizeof(DCEDATA));
pIF->Close();

pConn->Close();
session.Close();

wsprintf(buf,"CDSServername is %s",dce.CDSServerName);
AfxMessageBox(buf);
wsprintf(buf,"CellName is %s",dce.CellName);

return TRUE;
}

When I invoke this method thru the ActiveX Control Test Container, it throws an CInternetException exception 12007 at the GetFtpSession call. This I see when I debug the control and supply the ActiveX Control Test Container as the executable to debug with.

The argument I supply in this case is "ftp://mycomputername". On my NT 4.0 Workstation I have peer web services which has the FTP Server running.

What could be the reason for this exception ? In fact, if anyone could point me how to look up this exception that'd be far better !

Thanks
fstab.
0
Comment
Question by:fstab
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
Answers2000 earned 100 total points
ID: 1321142
I just typed in all...and got an error from Ex-Ex server.  Answer is in the comment below (retyping now)...
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1321143
I'll go for "if anyone could point me how to look up this exception that'd be far better !"

From the MSVC docs on CInternetException
(begin quote)
For a list of Win32 error codes, see Error Codes in the Win32 SDK. For a list of Internet-specific error codes, see the ActiveX SDK documentation.
(end quote)
There's a link to Win32 error codes (you've probably seen this) but not to Internet error codes,  therefore switch to text search...

From WININET.H (I found the header using the Find In Files option in MSVC)
(begin quote)
#define INTERNET_ERROR_BASE                     12000

#define ERROR_INTERNET_OUT_OF_HANDLES           (INTERNET_ERROR_BASE + 1)
#define ERROR_INTERNET_TIMEOUT                  (INTERNET_ERROR_BASE + 2)
#define ERROR_INTERNET_EXTENDED_ERROR           (INTERNET_ERROR_BASE + 3)
#define ERROR_INTERNET_INTERNAL_ERROR           (INTERNET_ERROR_BASE + 4)
#define ERROR_INTERNET_INVALID_URL              (INTERNET_ERROR_BASE + 5)
#define ERROR_INTERNET_UNRECOGNIZED_SCHEME      (INTERNET_ERROR_BASE + 6)
#define ERROR_INTERNET_NAME_NOT_RESOLVED        (INTERNET_ERROR_BASE + 7)
[tonnes more follow]
(end quote)


Therefore your error is (from ActiveX SDK)
(begin quote)
ERROR_INTERNET_NAME_NOT_RESOLVED
The server name could not be resolved.
(end quote)
0
 
LVL 1

Author Comment

by:fstab
ID: 1321144
Thanks for the look up. I was also looking for sample code to catch this exception programmatically. If that could be provided too it would help me in troubleshooting when this error occurs without doing it in the Debugger. I will rate your answer as excellent when you do that.

Thanks
fstab.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question