Solved

WinInet exception - help !

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Show shut-down message as Windows 8 shuts down. 9 91
Perl Awk Need Help 3 118
maxBlock challenge 30 129
Not needed 13 112
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

777 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