Help: getting updates from a remote server.

Post Reply
HunterEC
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Help: getting updates from a remote server.

Post by HunterEC »

I'm having my first steps with FiveWin / xHarbour. :oops:
My customers need to download updated data from our servers to keep their database up to date. Is there is a way that they can download their data (if entitled to, subscription based) automatically ? Something like anti-virus software does it ? How can this be done using FiveWin ?
Sheng
Posts: 15
Joined: Mon Sep 29, 2008 1:41 pm

Re: Help: getting updates from a remote server.

Post by Sheng »

HunterEC wrote:I'm having my first steps with FiveWin / xHarbour. :oops:
My customers need to download updated data from our servers to keep their database up to date. Is there is a way that they can download their data (if entitled to, subscription based) automatically ? Something like anti-virus software does it ? How can this be done using FiveWin ?
you can use tftp class to get files.
Davide
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: Help: getting updates from a remote server.

Post by Davide »

HunterEC wrote:Is there is a way that they can download their data (if entitled to, subscription based) automatically ?
In addition to tftp you can even use tWebClient and the IE-ActiveX to retrieve remotely hosted files.
Regards,
Davide
hag
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California
Contact:

Post by hag »

Can you post some code on how this might be done. Thanks

Harvey
Thank you
Harvey
Sheng
Posts: 15
Joined: Mon Sep 29, 2008 1:41 pm

Post by Sheng »

hag wrote:Can you post some code on how this might be done. Thanks

Harvey

Code: Select all

              // Create ftp connect
              oFtp := TFtp():New( cFTP_IP, oInternet, cUsername, cPassword )
              If oFtp:hFtp == 0
                 Tone( 1000, 1 )
                 MsgStop( "Ftp connect fail!", "Error!" )
                 oFtp:End()
                 Exit
              EndIf
              :
              :
              :
              // Open remote file
              oFtpFile := TFtpFile():New( cServerFile, oFtp )
              oFtpFile:lBinary := .T.
              //
              oFtpFile:OpenRead()      // Open and Read mode
                  If oFtpFile:nError <> 0
                  Tone( 1000, 1 )
                  MsgStop( "ftp file:["+cServerFile+"]Open & read fail!!", "Error!" )
                  oFtpFile:End()
                  lRet := .F.
                  Exit
               EndIf
hag
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California
Contact:

Post by hag »

Sheng:

Thanks for the data. I'll give it a try in a couple of days. Thanks again.

Harvey
Thank you
Harvey
HunterEC
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Post by HunterEC »

Davide, Hag, Sheng: thank you all. I'll give it a try. :D
Davide
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Post by Davide »

hag wrote:Can you post some code on how this might be done.
TWebClient allows you retrieving a file via the standard http port 80. Please see \fwh\samples\webclien.prg
For the IE-ActiveX you need the most recent FWH. Antonio has posted a sample at: http://www.fivetechsoft.com/forums/view ... hp?t=12514
Hi,
Davide
ShumingWang
Posts: 454
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

Post by ShumingWang »

hi,
If webclient / TFTP can overwrite even if the file is open or at running ?
For example: my.exe ,my.dll,libmysql.dll are running, overwrite them besides they are running.
Under Linux ,could.

Shuming Wang
hag
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California
Contact:

Post by hag »

Sheng:

You posted some code here. Could you post the complete function so I can see what the values for the variables come from.

Thanks

Your Code

Code: Select all

// Create ftp connect 
              oFtp := TFtp():New( cFTP_IP, oInternet, cUsername, cPassword ) 
              If oFtp:hFtp == 0 
                 Tone( 1000, 1 ) 
                 MsgStop( "Ftp connect fail!", "Error!" ) 
                 oFtp:End() 
                 Exit 
              EndIf 
              : 
              : 
              : 
              // Open remote file 
              oFtpFile := TFtpFile():New( cServerFile, oFtp ) 
              oFtpFile:lBinary := .T. 
              // 
              oFtpFile:OpenRead()      // Open and Read mode 
                  If oFtpFile:nError <> 0 
                  Tone( 1000, 1 ) 
                  MsgStop( "ftp file:["+cServerFile+"]Open & read fail!!", "Error!" ) 
                  oFtpFile:End() 
                  lRet := .F. 
                  Exit 
               EndIf 
User and pass word i understand.
What about: cFTP_IP, cServerfile what are these values?
Thank you
Harvey
Sheng
Posts: 15
Joined: Mon Sep 29, 2008 1:41 pm

Post by Sheng »

hag wrote:Sheng:

You posted some code here. Could you post the complete function so I can see what the values for the variables come from.

Thanks

Your Code

Code: Select all

// Create ftp connect 
              oFtp := TFtp():New( cFTP_IP, oInternet, cUsername, cPassword ) 
              If oFtp:hFtp == 0 
                 Tone( 1000, 1 ) 
                 MsgStop( "Ftp connect fail!", "Error!" ) 
                 oFtp:End() 
                 Exit 
              EndIf 
              : 
              : 
              : 
              // Open remote file 
              oFtpFile := TFtpFile():New( cServerFile, oFtp ) 
              oFtpFile:lBinary := .T. 
              // 
              oFtpFile:OpenRead()      // Open and Read mode 
                  If oFtpFile:nError <> 0 
                  Tone( 1000, 1 ) 
                  MsgStop( "ftp file:["+cServerFile+"]Open & read fail!!", "Error!" ) 
                  oFtpFile:End() 
                  lRet := .F. 
                  Exit 
               EndIf 
User and pass word i understand.
What about: cFTP_IP, cServerfile what are these values?
cFtp_IP: is ftp server ip or domain name.
cServerFile: is filename at ftp server.
HunterEC
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Post by HunterEC »

Guys:

Thank you all for your help. I'll give it a try. :D
Post Reply