Solved

WinInet exception - help !

Posted on 1998-08-21
3
1,256 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
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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 shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

830 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