Page 1 of 1

Help: getting updates from a remote server.

Posted: Tue Oct 21, 2008 6:15 am
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 ?

Re: Help: getting updates from a remote server.

Posted: Tue Oct 21, 2008 9:42 am
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.

Re: Help: getting updates from a remote server.

Posted: Tue Oct 21, 2008 11:05 am
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

Posted: Wed Oct 22, 2008 2:26 am
by hag
Can you post some code on how this might be done. Thanks

Harvey

Posted: Wed Oct 22, 2008 3:14 am
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

Posted: Wed Oct 22, 2008 3:43 am
by hag
Sheng:

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

Harvey

Posted: Wed Oct 22, 2008 5:28 am
by HunterEC
Davide, Hag, Sheng: thank you all. I'll give it a try. :D

Posted: Wed Oct 22, 2008 1:27 pm
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

Posted: Thu Oct 23, 2008 1:08 am
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

Posted: Sun Oct 26, 2008 6:41 pm
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?

Posted: Mon Oct 27, 2008 1:40 am
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.

Posted: Sat Nov 01, 2008 9:37 am
by HunterEC
Guys:

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