Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check to see if Internet is available

Status
Not open for further replies.

dendic

Programmer
Jan 19, 2003
106
US
In my database I send a document to an FTP site by the click of a command button. But sometimes either the site is not available or my router is locked up and the document doesn't go through. Is there anyway I can send a message to the operator that the document did not go through and the reason why?
 
This may help:
check for internet connection
thread705-1173542
 
I need to check if the router is up.
 
Since you have not posted much of what you are actually doing I will simply give you an example of several apps we have running that do pretty much the same thing.

Using a form with an INET control on it.

1. create the connection string to the ftp sit
2. start the upload
3. using a loop while the inet is
Do
For iWait = 1 To 1000
DoEvents
Next iWait

Loop Until Not netUpload.StillExecuting

IF the net is not available or the file fails for whatever reason it will be displayed using the responseinfo method from the inet control like this.

lbltimer.Caption = lbltimer.Caption & " Response: " & netUpload.ResponseInfo



Andy Baldwin

"Testing is the most overlooked programming language on the books!
 
I'm not familiar with the inet control. Can I somehow ping the router with code and if OK then send?
 
Can you post the portion of your code that is connecting to the ftp and pass the file? My example was a guess since you did not post much information in your original question. There are several ways to connect to an ftp site, one of which is to use a Micorosoft INET control on your form and set up its connection information.

Can not really address your particular problem without knowing the particulars of how you are connecting and what you have available in your code.

Just because you can ping the router does not mean that you can get past the router.

Thanks


Andy Baldwin

"Testing is the most overlooked programming language on the books!
 
Here is my code.
Set myftp = New CInternetFTP
myftp.OpenSession
myftp.Server = varServer
myftp.TransferType = eftbinary
myftp.Connect varUserName, varServer, varPassword
myftp.UserName = varUserName
myftp.Password = varPassword
myftp.PutFile Chr(34) & varLocalPath & Chr(34), Chr(34) & varRemotePath & Chr(34)
myftp.CloseSession
Set myftp = Nothing
 
Not familiar with the CINTERNTEFTP object. Can you tell me what references you have. I am going to jump out on a limb and assume that it has a while busy method you can test for to see if the upload or connection is working, much like the code I used above. If so you can test for this and on a time out or connection error you can write code to send your message.

Andy Baldwin

"Testing is the most overlooked programming language on the books!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top