FTP access suddenly doesn't work!?

FTP access suddenly doesn't work!?

Postby codemaker » Mon Dec 12, 2011 7:24 pm

I am using something like this for years:
Code: Select all  Expand view

oInternet := TInternet():New()
oFTP      := TFTP():New(  "207.46.133.140", oInternet ) // Microsoft FTP
 

Suddenly today, this code returns
"oFtp:Hftp is null"

I didn't change any part of code for a very long time, it works perfect. No need to change enything.
Today I run the program and tried to send files the program didn't work??

Probably it has to do with something I installed recently.
How can I test and check?

I need help because I use FTP file sending arround prrty much.

Thanks
Boris
User avatar
codemaker
 
Posts: 208
Joined: Wed Dec 03, 2008 4:48 pm
Location: Belgrade, Serbia

Re: FTP access suddenly doesn't work!?

Postby Otto » Mon Dec 12, 2011 10:24 pm

Hello Boris,

I tried and my FTP programs work as usually.
Best regards,
Otto


oInternet := TInternet():New()
oFTP := TFTP():New( "test.info", oInternet, User, Passwort )
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 5998
Joined: Fri Oct 07, 2005 7:07 pm

Re: FTP access suddenly doesn't work!?

Postby ukservice » Tue Dec 13, 2011 10:44 am

Boris,

Please, look at Firewall or Antivirus.

If you provide a full working example I can test it.

I do not experience problems with FTP.
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
User avatar
ukservice
 
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

Re: FTP access suddenly doesn't work!?

Postby James Bott » Tue Dec 13, 2011 5:29 pm

Hi Boris,

I suspect that the FTP dll is missing, corrupted, a new incompatible version, or it is not registered in the Windows registry.

Try checking the valtype of oInternet.

oInternet := TInternet():New()
msgInfo(valtype(oInternet))

If it is not "O" then it is a problem with the DLL. I do not know the name and location of the DLL. Perhaps someone else does?

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: FTP access suddenly doesn't work!?

Postby James Bott » Tue Dec 13, 2011 5:39 pm

Boris,

It could also be that the program is not getting a connection to the FTP site. Have you tried to connect using another FTP program?

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: FTP access suddenly doesn't work!?

Postby ADutheil » Tue Dec 13, 2011 6:08 pm

The server 207.46.133.140 is down. Did you try another one?
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: FTP access suddenly doesn't work!?

Postby codemaker » Tue Dec 13, 2011 6:43 pm

Thanks for all your answers.

I can access FTP sites using browser or for example Windows Commander.
I cannot access only from any of my xHarbour/FWH programs.
The code for accessing the FTP is the same for years now. And what is worst, it worked properly 4-5 days ago... :(
Not using any specific DLL, just the FWH class.
Something happened in the meantime.

I tried the same programs on my other computers - all works fine!
I am not using firewall of any kind and my antivirus programs are not blocking this program...

Speaking about Windows Firewayll, this stupid thing never worked on my machine. I cannot even start it. Something happened in system and firewall is out of order. Therefore, cannot even check if the firewall took over some ports or something.
User avatar
codemaker
 
Posts: 208
Joined: Wed Dec 03, 2008 4:48 pm
Location: Belgrade, Serbia

Re: FTP access suddenly doesn't work!?

Postby James Bott » Tue Dec 13, 2011 6:55 pm

Boris,

>Not using any specific DLL, just the FWH class.

But you are using a DLL. It is loaded by TInternet()new(). This method calls the wininet() function. In the program FW\source\winapi\wininet.prg you will find:

Code: Select all  Expand view
function WinINet()

   if hWinINet == nil
      hWinINet = LoadLib32( "WinINet.dll" )
      if Abs( hWinINet ) <= 32
         MsgStop( "Cannot load WinINet.dll!" )
      endif
   endif
return hWinINet


So you can see wininet.dll is being loaded. However, it appears that if it is not successfully loaded you will get an error message which I assume you are not getting. So the DLL may be a newer or older one that was installed by some other program installation you made recently.

Or, the problem could be a change to the firewall that is not allowing you to connect to the FTP site. Did you try connecting to that site on the same PC with another FTP utility program?

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: FTP access suddenly doesn't work!?

Postby codemaker » Tue Dec 13, 2011 9:16 pm

Yes James, as I wrote:
"I can access FTP sites using browser or for example Windows Commander."
I can access any FTP site using some Internet browser or Windows Commander FTP control or some FTP client. All these programs run fine and connect witout any problem.

So, my conclusion is that you may be right - "WinInet.dll" is probbaly either corrupted or replaced by some different version when some program installed recently. Will compare the DLLs and see if there is something I can find.
I cannot think out any other reason fro rhis recent FTP problem from my programs.

I get the error that the program cannot connect to the specified site

Thanks
User avatar
codemaker
 
Posts: 208
Joined: Wed Dec 03, 2008 4:48 pm
Location: Belgrade, Serbia

Re: FTP access suddenly doesn't work!?

Postby James Bott » Tue Dec 13, 2011 10:10 pm

Boris,

>I get the error that the program cannot connect to the specified site

One other possibility is that it cannot connect only to the desired site. Try changing to a different site using the same FW program.

I suppose it also possible that the firewall is only blocking your FW program but allowing others access.

Have you tried rebooting? Sometimes this seems to fix some vary strange problems.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: FTP access suddenly doesn't work!?

Postby codemaker » Wed Dec 14, 2011 1:59 pm

James Bott wrote:Boris,
One other possibility is that it cannot connect only to the desired site. Try changing to a different site using the same FW program.

I changed the ftp sites to access from my FWH programs, nione of them can access any site

James Bott wrote:I suppose it also possible that the firewall is only blocking your FW program but allowing others access.

I made another brand new FWH program, which is supposed not to be even known tlo firewall yet, still the same problem.

James Bott wrote:Have you tried rebooting? Sometimes this seems to fix some vary strange problems.

Of course, every night I go to sleep and shutdown the laptop :)

Anyway, will check the WinInet.DLL
Thanks for attention
User avatar
codemaker
 
Posts: 208
Joined: Wed Dec 03, 2008 4:48 pm
Location: Belgrade, Serbia

Re: FTP access suddenly doesn't work!?

Postby codemaker » Sat Dec 17, 2011 1:28 am

My Windows 7 is Ultimate version

In c:\windows\system32 there is WININET.DLL of size 1,126,912 bytes, date 15.May 2011
Have no idea if this is the correct size and date
I installed this OS much before 15.May 2011 so this DLL is NOT from the original installation. Which program if any changed it, have no clue..

Also there are several strange named folders with different size of WININET.DLL as on screen below:
Image
Have no idea what these folders are..

Also on two of my develop folders for two different applications I found WININET.DLL
- one is 977,920 in size and date 19.December 2009
- second is 599,040 in size date 29.July 2002
Have no idea from where these DLLs are copied here and when.

Somebody knows whic isn the correct size and date of the WININET.DLL for Windows 7 Ultimate?
IS this DLL I have in \system32 the correct DLL?

Thanks

PS
Definitely, something happened with the FWH compiled programs. NONE of my FWH programs now can access any FTP (I changed FTP servers and NONE was accessed)
I can access FTP servers using Firefox and any other internet browser, Windows Commander, FlashGet or any client I can find. No problem. Only FWH programs cannot access any FTP??
Cannot even imagine why FWH programs cannot acces FTP any more and ALL OTHER FTP clients works normaly?
User avatar
codemaker
 
Posts: 208
Joined: Wed Dec 03, 2008 4:48 pm
Location: Belgrade, Serbia

Re: FTP access suddenly doesn't work!?

Postby Enrico Maria Giordano » Sat Dec 17, 2011 10:33 am

Please try the following sample (with your userid, password, path and filename) and let me know the result:

Code: Select all  Expand view
#include "Fivewin.ch"


//
// File attributes
//

#define FILE_ATTRIBUTE_READONLY  1
#define FILE_ATTRIBUTE_HIDDEN    2
#define FILE_ATTRIBUTE_SYSTEM    4
#define FILE_ATTRIBUTE_DIRECTORY 16
#define FILE_ATTRIBUTE_ARCHIVE   32
#define FILE_ATTRIBUTE_NORMAL    128
#define FILE_ATTRIBUTE_TEMPORARY 256


//
// access types for InternetOpen()
//

#define INTERNET_OPEN_TYPE_PRECONFIG                    0   // use registry configuration
#define INTERNET_OPEN_TYPE_DIRECT                       1   // direct to net
#define INTERNET_OPEN_TYPE_PROXY                        3   // via named proxy
#define INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY  4   // prevent using java/script/INS


//
// manifests
//

#define INTERNET_INVALID_PORT_NUMBER    0           // use the protocol-specific default

#define INTERNET_DEFAULT_FTP_PORT       21          // default for FTP servers
#define INTERNET_DEFAULT_GOPHER_PORT    70          //    "     " gopher "
#define INTERNET_DEFAULT_HTTP_PORT      80          //    "     " HTTP   "
#define INTERNET_DEFAULT_HTTPS_PORT     443         //    "     " HTTPS  "
#define INTERNET_DEFAULT_SOCKS_PORT     1080        // default for SOCKS firewall servers.


//
// service types for InternetConnect()
//

#define INTERNET_SERVICE_FTP     1
#define INTERNET_SERVICE_GOPHER  2
#define INTERNET_SERVICE_HTTP    3


//
// flags for FTP
//

#define INTERNET_FLAG_TRANSFER_ASCII  1
#define INTERNET_FLAG_TRANSFER_BINARY 2


FUNCTION MAIN()

    LOCAL hInternet, hConnect

    hInternet = INTERNETOPEN( "Anystring", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0 )

    hConnect = INTERNETCONNECT( hInternet, "myftpaddress", INTERNET_INVALID_PORT_NUMBER, "myuserid", "mypassword", INTERNET_SERVICE_FTP, 0, 0 )

    ? FTPGETFILE( hConnect, "/emagsoftware.it/test/atest.prg", "atest.prg", 0, FILE_ATTRIBUTE_ARCHIVE, 0, 0 )

//    ? FTPPUTFILE( hConnect, "atest.prg", "/emagsoftware.it/test/atest.prg", 0, 0 )

    INTERNETCLOSEHANDLE( hConnect )

    INTERNETCLOSEHANDLE( hInternet )

    RETURN NIL


#pragma BEGINDUMP

#include "windows.h"
#include "wininet.h"
#include "hbapi.h"


HB_FUNC( INTERNETOPEN )
{
    hb_retnl( ( LONG ) InternetOpen( hb_parc( 1 ), hb_parnl( 2 ), hb_parc( 3 ), hb_parc( 4 ), hb_parnl( 5 ) ) );
}


HB_FUNC( INTERNETCLOSEHANDLE )
{
    hb_retl( InternetCloseHandle( ( HINTERNET ) hb_parnl( 1 ) ) );
}


HB_FUNC( INTERNETCONNECT )
{
    hb_retnl( ( LONG ) InternetConnect( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ), ( INTERNET_PORT ) hb_parnl( 3 ), hb_parc( 4 ), hb_parc( 5 ), hb_parnl( 6 ), hb_parnl( 7 ), hb_parnl( 8 ) ) );
}


HB_FUNC( FTPGETFILE )
{
    hb_retl( FtpGetFile( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ), hb_parc( 3 ), hb_parl( 4 ), hb_parnl( 5 ), hb_parnl( 6 ), hb_parnl( 7 ) ) );
}


HB_FUNC( FTPPUTFILE )
{
    hb_retl( FtpPutFile( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ), hb_parc( 3 ), hb_parnl( 4 ), hb_parnl( 5 ) ) );
}


HB_FUNC( FTPDELETEFILE )
{
    hb_retl( FtpDeleteFile( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ) ) );
}


HB_FUNC( FTPCREATEDIRECTORY )
{
    hb_retl( FtpCreateDirectory( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ) ) );
}


HB_FUNC( FTPREMOVEDIRECTORY )
{
    hb_retl( FtpRemoveDirectory( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ) ) );
}


HB_FUNC( FTPFINDFIRSTFILE )
{
    hb_retnl( ( LONG ) FtpFindFirstFile( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ), ( WIN32_FIND_DATA * ) hb_parc( 3 ), hb_parnl( 4 ), hb_parnl( 5 ) ) );
}


HB_FUNC( INTERNETFINDNEXTFILE )
{
    hb_retl( InternetFindNextFile( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ) ) );
}

#pragma ENDDUMP


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8300
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: FTP access suddenly doesn't work!?

Postby codemaker » Sun Dec 18, 2011 12:38 am

Wov! Thanks Enrico!
It works!

Hovewer, I hate to realise I have no idea what is the difference now?
All thedse years I used one code and now this.

Does your code uses any DLL or what?
Have no idea how comes your code works and the code I used for years, suddenly don't

In any case, with your permission I will use your solution from now on?

Thank you so much.

PS: young scientist is not that young any more, she is a big girl now? :)
Say hi to her from me
User avatar
codemaker
 
Posts: 208
Joined: Wed Dec 03, 2008 4:48 pm
Location: Belgrade, Serbia

Re: FTP access suddenly doesn't work!?

Postby Enrico Maria Giordano » Sun Dec 18, 2011 11:12 am

codemaker wrote:Wov! Thanks Enrico!
It works!

Hovewer, I hate to realise I have no idea what is the difference now?


I don't know, sorry. You have to check TInternet and TFTP classes.

codemaker wrote:Does your code uses any DLL or what?


Yes, it implicitly uses wininet.dll.

codemaker wrote:In any case, with your permission I will use your solution from now on?


You're welcome.

codemaker wrote:PS: young scientist is not that young any more, she is a big girl now? :)


Yes. :-)

codemaker wrote:Say hi to her from me


Ok, thank you. :-)

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8300
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 14 guests