15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


MSVC 4.2 ftptree sample fails

Dave Kolb -- sasdxk@wnt.sas.com
Friday, January 10, 1997

Environment: VC++ 4.2b and Windows NT 4.0 SP2

Has anyone gotten the VC4.2 FTPTREE sample to run? My call to 
m_pInetSession->CftpConnection throws a CinternetException message of 
"The FTP session was terminated" after hanging for about a minute.
I have this problem going after internal or external sites though apps 
like ftp (local sites only) or IE3 (which can access local or external 
via a proxy) can access the sites just fine.





Mike Blaszczak -- mikeblas@nwlink.com
Monday, January 13, 1997

[Mini-digest: 3 responses]

At 12:58 1/10/97 -0500, Dave Kolb wrote:
>Environment: VC++ 4.2b and Windows NT 4.0 SP2

>Has anyone gotten the VC4.2 FTPTREE sample to run?

Works great for me.

You might want to check that the session is created in a way that's
compatible with your networking setup, and that WININET.DLL is,
indeed, properly configured to run on your system.



.B ekiM
http://www.nwlink.com/~mikeblas/      <-- trip report central!
95 Honda VFR-750F / 88 Yamaha FZ-700 (damaged) / 94 Mazda RX-7
Serial #00050!    /      AMA - HRC - VFROC     / Wang Dang Wankel
         I am bored of this talk. It is time now for the dancing!
These words are my own - I do not speak on behalf of Microsoft.


-----From: Slh1995@aol.com

In a message dated 97-01-12 14:06:11 EST, you write:

<< Has anyone gotten the VC4.2 FTPTREE sample to run?  >>
runs fine for me under win95...
-Steve
www.mindq.com

-----From: sathiya@colmds2.com (Sathiyamurthy Thiruvengadathan)

Dave Kolb wrote:
> 
> Environment: VC++ 4.2b and Windows NT 4.0 SP2
> 
> Has anyone gotten the VC4.2 FTPTREE sample to run? My call to
> m_pInetSession->CftpConnection throws a CinternetException message of
> "The FTP session was terminated" after hanging for about a minute.
> I have this problem going after internal or external sites though apps
> like ftp (local sites only) or IE3 (which can access local or external
> via a proxy) can access the sites just fine.
  I have run the VC4.2 FTPTREE sample and I didn't face any problems. I
could reach the default site (ftp.microsoft.com) as well as other sites
which I wanted to test. The sample tries to connect as an anonymous user
and probably u don't have the permissions at the sites u tested.

Sathya



Dave Kolb -- sasdxk@wnt.sas.com
Tuesday, January 14, 1997


<>

Not sure what you mean by "session is created in a way...properly 
configured"?

My IE3 (4.70.1215) config has a proxy setting that it uses and my hope 
was that CftpConnection used the same proxy values transparently in 
ftptree (i.e. just address ftp.microsoft.com like ftptree does by 
default).

The control panel Internet applet also shows the http server should 
use the proxy address of inetgw.unx.sas.com and port 80. Is this not 
relevant? If IE3 works just fine and can address 
http://ftp.microsoft.com and shows me a dir list, should ftptree also 
do this OK thru the same proxy settings? Is there something different 
to setup for the wininet api's?



When do MSVC help for ftptree and run the ftptree.exe that I'm shown 
in a list box after clicking on the help article sample button, I get 
a complaint that ftptree is not in my msdev\help dir. The actual 
sample dir on the CD also has no exe file so I'm stuck using the one I 
build rather than a supplied exe. My build works OK though. I've tried 
this on other machines also to no avail.

Ideas?

Thanks,






Slh1995@aol.com
Wednesday, January 15, 1997

[Mini-digest: 3 responses]

In a message dated 97-01-15 14:09:25 EST, you write:

<< Not sure what you mean by "session is created in a way...properly=20
 configured"?
 My IE3 (4.70.1215) config has a proxy setting that it uses and my hope=20
 was that CftpConnection used the same proxy values transparently in=20
 ftptree (i.e. just address ftp.microsoft.com like ftptree does by defaul=
t).=20
 The control panel Internet applet also shows the http server should=20
 use the proxy address of inetgw.unx.sas.com and port 80. Is this not=20
 relevant? If IE3 works just fine and can address=20
 http://ftp.microsoft.com and shows me a dir list, should ftptree also=20
 do this OK thru the same proxy settings? Is there something different=20
 to setup for the wininet api's? >>

You probably have to modify the ftptree code where it creates the
CInternetSession object to pass a proxy name.  Here is ref in the online =
doc:

CInternetSession( LPCTSTR pstrAgent =3D NULL, DWORD dwContext =3D 1, DWOR=
D
dwAccessType =3D PRE_CONFIG_INTERNET_ACCESS, LPCTSTR pstrProxyName =3D NU=
LL,
LPCTSTR pstrProxyBypass =3D NULL, DWORD dwFlags =3D 0 );
 =20
Parameters
pstrAgent   A pointer to a string that identifies the name of the applica=
tion
or entity calling the Internet functions.

dwAccessType   The type of access required. The following are valid value=
s,
exactly one of which may be supplied:=20
=B7	INTERNET_OPEN_TYPE_PRECONFIG   Preconfigured (in the registry). This =
access
type is set as the default.
=B7	INTERNET_OPEN_TYPE_DIRECT   Direct to Internet.=20
=B7	INTERNET_OPEN_TYPE_PROXY   Through CERN proxy.

pstrProxyName   The name of the preferred CERN proxy if dwAccessType is s=
et
as INTERNET_OPEN_TYPE_PROXY. The default is NULL.

pstrProxyBypass   A pointer to a string containing an optional list of se=
rver
addresses. These addresses may be bypassed when using proxy access. If a =
NULL
value is supplied, the bypass list will be read from the registry. This
parameter is meaningful only if dwAccessType is set to
INTERNET_OPEN_TYPE_PROXY.=20

dwFlags   Indicates various options such as caching and asynchronous
behavior. The default is set to 0.=20

-----From: Mike Blaszczak 

At 10:47 1/14/97 -0500, Dave Kolb wrote:

>The control panel Internet applet also shows the http server should 
>use the proxy address of inetgw.unx.sas.com and port 80. Is this not 
>relevant?

Nope.  FTPTREE uses FTP, not HTTP.

>If IE3 works just fine and can address 
>http://ftp.microsoft.com and shows me a dir list, should ftptree also 
>do this OK thru the same proxy settings? 

Not necessarily.  Maybe you should be using a proxy for FTP and IE can
handle that negotiation, but FTPTREE has no such code.  Maybe your
FTP proxy isn't configured correctly, or maybe it's incompatible with
WININET. Maybe you need to alter the parameters to the CInternetSession
constructor in the FTPTREE sample to conform to your environment.

There are tens of dozens of different ways to configure and implement
access to the Internet. It's nearly impossible to diagnose this kind of
problem at a distance: you need to work with your network administrators
and the ActiveX SDK documentation to figure out what's going on in your
specific situation.


.B ekiM
http://www.nwlink.com/~mikeblas/
Why does the "new" Corvette look like a 1993 RX-7?
These words are my own. I do not speak on behalf of Microsoft.

-----From: MTracy@prismsolutions.com (MTracy)

     At 12:58 1/10/97 -0500, Dave Kolb wrote: >Environment: VC++ 4.2b and 
     Windows NT 4.0 SP2
     
     >Has anyone gotten the VC4.2 FTPTREE sample to run?
     
     I got it to run fine also. however, I did have a problem running this 
     with 
     
     .B ekiM wrote ----------------------
     
     >You might want to check that the session is created in a way that's 
     >compatible with your networking setup, and that WININET.DLL is, 
     >indeed, properly configured to run on your system.
     
     I did check this and the ftptree got a connection to my ftp server.
     
     Sathiyamurthy Thiruvengadathan wrote ---------
     
     >I have run the VC4.2 FTPTREE sample and I didn't face any problems. I
     >could reach the default site (ftp.microsoft.com) as well as other 
     >sites which I wanted to test. The sample tries to connect as an 
     >anonymous user and probably u don't have the permissions at the sites 
     >u tested.
     
     This worked for me also.  I had the same problem using this to an ftp 
     server (Windows NT machine) on my local network.  I was able to solve 
     it with the following code.
     
     void CMyTreeCtrl::ExploreDir(const CString& strDir, HTREEITEM hParent)
     {
        ....
        while (hIT != NULL)
        {
                hTemp = GetNextSiblingItem(hIT);
                DeleteItem(hIT);
                hIT = hTemp;
        }
     
        // prepare to find all the files in the specified directory
        if (hParent != GetRootItem())
        {
                // strSearchDir = strDir + _T("/*");
                CString strTempDir = strDir.Right(strDir.GetLength()-1);
                strSearchDir = strTempDir + _T("/*");
        }
        else
        {
                // strSearchDir = _T("/*");
                strSearchDir = _T("*");
        }
     
        ...
     
     }
     
     What was happening was that the directory search routine was timing 
     out and thus you got your error message!!!  I was able to determine 
     the problem by using a third party ftp tool to go through the same 
     commands sent to my problem ftp server from ftptree.  I am not sure 
     that this solution applies to all situations, I haven't tested it.  I 
     just wanted to get it working... 
     
     I hope this helps. Best of luck
     
     mark tracy
     



Dave Kolb -- sasdxk@wnt.sas.com
Friday, January 17, 1997

-----Original Message-----
From:	Slh1995@aol.com [SMTP:Slh1995@aol.com]
Sent:	Wednesday, January 15, 1997 8:38 PM
To:	mfc-l@netcom.com
Subject:	Re: MSVC 4.2 ftptree sample fails

This message was sent using a character set not supported on the
Internet Mail Connector. The message text has been placed into the
attachment: ATT01717.txt. To view, double-click on the attachment. If
the text isn't displayed correctly, save the attachment to disk, and
then use a viewer that can display the original character set. << File:
ATT01717.txt; charset = unknown-8bit >> 

Wonder why this post came from AOL in a weird char set that was
imbedded?

Anyway, I got ftptree to work by recoding the CInternetSession
constructor as suggested.

By the way, the ftptree code is wrong as it leaves out the 2nd parameter
"dwContext".

I changed:

	m_pInetSession = new CInternetSession(str, PRE_CONFIG_INTERNET_ACCESS);

to:
	m_pInetSession = new CInternetSession(str, 1, INTERNET_OPEN_TYPE_PROXY,
"inetgw.unx.sas.com", "*.sas.com;*.*.sas.com");

and ftptree worked. I wonder how other folks get out of the intranet to
the Internet without adding the proxy parm?

I was assuming CInternetSession proxy usage was transparent by default
if the Control Panel Internet applet configured it and did not realize
the app had to be configured to mention a proxy server and bypass list.
Seems like CInternetSession should do this by looking in the registry
for the default CInternetSession construction though (should it?).

<<
Nope.  FTPTREE uses FTP, not HTTP.
>>

Sorry Mike, I of course did mean FTP protocol not HTTP...

Thanks,

Dave
> 



Mike Blaszczak -- mikeblas@nwlink.com
Sunday, January 19, 1997

[Mini-digest: 2 responses]

At 10:05 1/17/97 -0500, Dave Kolb wrote:

>I changed:
>	m_pInetSession = new CInternetSession(str, PRE_CONFIG_INTERNET_ACCESS);
>to:
>	m_pInetSession = new CInternetSession(str, 1, INTERNET_OPEN_TYPE_PROXY,
>"inetgw.unx.sas.com", "*.sas.com;*.*.sas.com");
>
>and ftptree worked. I wonder how other folks get out of the intranet to
>the Internet without adding the proxy parm?

If you read the ActiveX SDK documentation on the WININET library, you should
be able to work out what's different between your configuration (as stored
in the registry) and the explicit parameter's you've offered the
Internet connection object.

It's possible that IE works through your misconfiguration by sniffing around
and reacting to extra information provided by servers it bumps into.  IE
has lots and lots and lots of such reacitve code built into it to handle
those sorts of situations.


.B ekiM
http://www.nwlink.com/~mikeblas/
Why does the "new" Corvette look like a 1993 RX-7?
These words are my own. I do not speak on behalf of Microsoft.

-----From: "Senthil .P" 

>>My IE3 (4.70.1215) config has a proxy setting that it uses and my hope 
>>was that CftpConnection used the same proxy values transparently in 
>>ftptree (i.e. just address ftp.microsoft.com like ftptree does by 
>default).

The proxy setting is only for Internet Explorer (it is not a system-wide
setting).

>>The control panel Internet applet also shows the http server should 
>>use the proxy address of inetgw.unx.sas.com and port 80. Is this not 
>relevant?

No it is not relevant. Internet Explorer and your FTP application are
two different applications. They do not share the same configuration
settings.

>>If IE3 works just fine and can address 
>>http://ftp.microsoft.com and shows me a dir list, should ftptree also 
>>do this OK thru the same proxy settings? Is there something different 
>>to setup for the wininet api's?

When you want to use a proxy, in the constructor for CInternetSession,
you have to specify dwAccessType as INTERNET_OPEN_TYPE_PROXY and specify
pstrProxyName to the proxy server address (in your case
inetgw.unx.sas.com; You could populate this be reading the proxy server
setting for IE 3.0 through the registry. It must be a key value
somewhere). Only then the proxy server is recognised and communication
is routed through the proxy server.

>



Dave Kolb -- sasdxk@wnt.sas.com
Tuesday, January 21, 1997



>-----Original Message-----
>From:	Mike Blaszczak [SMTP:mikeblas@nwlink.com]
>Sent:	Sunday, January 19, 1997 6:31 PM
>To:	mfc-l@netcom.com
>Subject:	RE: MSVC 4.2 ftptree sample fails
>
>[Mini-digest: 2 responses]
>
>At 10:05 1/17/97 -0500, Dave Kolb wrote:
>
>>I changed:
>>	m_pInetSession = new CInternetSession(str, PRE_CONFIG_INTERNET_ACCESS);
>>to:
>>	m_pInetSession = new CInternetSession(str, 1, INTERNET_OPEN_TYPE_PROXY,
>>"inetgw.unx.sas.com", "*.sas.com;*.*.sas.com");
>>
>>and ftptree worked. I wonder how other folks get out of the intranet to
>>the Internet without adding the proxy parm?
>
>If you read the ActiveX SDK documentation on the WININET library, you should
>be able to work out what's different between your configuration (as stored
>in the registry) and the explicit parameter's you've offered the
>Internet connection object.
>
>It's possible that IE works through your misconfiguration by sniffing around
>and reacting to extra information provided by servers it bumps into.  IE
>has lots and lots and lots of such reacitve code built into it to handle
>those sorts of situations.
>
>[Dave Kolb]  
><<
>INTERNET_OPEN_TYPE_PRECONFIG 
>
>Retrieve the proxy or direct configuration from the registry. 
>
>lpszProxyName 
>
>If this parameter is NULL, the function reads proxy information from the
>registry.
>
>lpszProxyBypass 
>
>If this parameter is NULL, the function reads the bypass list from the
>registry. 
>>>
>I read them but figured I misunderstood the "PRE_CONFIG..." parm as it did
>not work thru my proxy for ftp.microsoft.com or anything else outside. So you
>ARE saying that I should NOT have had to add the INTERNET_OPEN_TYPE_PROXY
>parameter in order to go out thru my proxy if that is the way the IE3 proxy
>is configured properly? My parms on CInternetSession are the same as in my
>proxy settings and are the same as most folks around here (300+) use to gate
>out of the intranet. I guess I'll fool with the config some more.
>
>Maybe some others could post how they config their proxy settings - esp. the
>bypass values for local intranet names. Mine all use the same gateway address
>and port 80 except for "secure" which uses 8088.
>
>Thanks,
>
>Dave Kolb
>
>...
> >>The control panel Internet applet also shows the http server should 
>>>use the proxy address of inetgw.unx.sas.com and port 80. Is this not 
>>relevant?
>
>(following NOT from Mike b.) No it is not relevant. Internet Explorer and
>your FTP application are
>two different applications. They do not share the same configuration
>settings.
>
>[Dave Kolb]  No kidding. Actually, my question was whether wininet should
>transparently use the proxy settings for parm  PRE_CONFIG_INTERNET_ACCESS as
>opposed to HAVING to use parm    INTERNET_OPEN_TYPE_PROXY  to go thru the
>proxy I already had configured.  My understanding is that a proxy should be
>used transparently if configured. My point was that the Control Panel app and
>IE3 used the same config settings and the question was whether wininet used
>them also and indirectly then my app!




| Вернуться в корень Архива |