Checking and forcing internet connection

bluedude

Well-Known Member
Licensed User
Longtime User
Hi,

I'm using the ftp stuff but that does not automatically force the internet connection. Any other options to use to check and force?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User

Cableguy

Expert
Licensed User
Longtime User
You could send a request to Google with the HTTP library.
This site is online most of the time ;)
See this thread: http://www.b4x.com/forum/code-samples-tips/3619-checking-internet-connection.html

This code works as I am using it in my new aproach to dll2date....

There is no real way to force a device to connect to the internet. However depending on the device and the user setting, issuing a request may start a connection.

Most devices use a "Connect when needed" basis internet conection, so I believe that starting an internet connection should be possible using some WinMo API, but I dont know wich and it may be device dependant...
 

schimanski

Well-Known Member
Licensed User
Longtime User
If you only want to force a internet-connection, this is an easy way:

B4X:
Sub GPRS_Aufbau
   ErrorLabel(ConnectionError)
   DoEvents
   request.New1("http://www.adress.de")     ' init HTML-Object'
   request.KeepAlive=True
   request.GetResponse
   Return
   
   ConnectionError:   
End Sub

You don't need an existing internet-adress, because when the adress doesn't exist, the error label catches the error, but the internet-connection is hold on. I have tested ot on several Pocket-PCs, it always works.
 
Top