Solved

WinInet exception - help !

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Need a Shell script to start a service checking the port 6 47
deburging in oracle form 12 76
dog bark java program 15 82
Line meaning 9 77
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…
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…
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.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now