The library has changed its name because it confused some users. All updates will be made in the following post:
www.b4x.com
Older post
I am almost finished a project to add the possibility of ping to this library and it will allow you to control if the external Internet connection is active. In the example screens, where it says "connected?", it actually refers to whether the virtual Wi-Fi/data interface on the cell phone or the network card on the PC is enabled
[B4X] Check if interface status (WiFi, cell network data or LAN) has enabled or disabled
Check if the internet interfaces are active and if the Internet connection is possible IFStatus Events SocketStarted (Port As Int) Triggers when the socket starts SocketClosed Triggers when socket closes ConnectionStatusChanged (IPStatus As tpeIPs) Triggers when there is a change in the...
![www.b4x.com](/android/forum/proxy.php?image=https%3A%2F%2Fwww.b4x.com%2Fandroid%2Fforum%2Ffavicon-32x32.png&hash=bcf22ccc379ea83798b29b214de4d482&return_error=1)
Older post
I am almost finished a project to add the possibility of ping to this library and it will allow you to control if the external Internet connection is active. In the example screens, where it says "connected?", it actually refers to whether the virtual Wi-Fi/data interface on the cell phone or the network card on the PC is enabled
Change log:
- InetStatus
- Events
- SocketStarted (Port As Int)
Triggers when the socket starts- SocketClosed
Triggers when socket closes- ConnectionStatusChanged (IPStatus As tpeIPs)
Triggers when there is a change in the connection. Returns a tpeIPs type variable. See details below- Error (Msg As String)
Trigger when an error occurs, they can be the following:
- Socket not initialized.
- The IP format is not valid. Includes IPv4 or IPv6
- Can't initialize socket.
- Can't initialize socket on port NUM_OF_PORT
- Socket is already initialized on port NUM_OF_PORT
- Types
- tpeIPs (IsConnected As Boolean, ConnType As String, IP As String)
- IsConnected: True or False
- ConnType: NONE (B4X), WIFI (B4A/B4I), CELL (B4A/B4I) or LAN (B4J)
- IP: Valid IPv4 or IPv6
- Fields
- Tag As Object
Default: Null (It is always valuable to have a Tag field)
- IPs As tpeIPs
Default: IsConnected = False, ConnType = "NONE", IP: "127.0.0.1"- Methods
- Initialize (CallBack As Object, EventName As String)
Initializes the object. Add parameters to this method.- Start (Port As Int)
Start the socket on the desired port
IMPORTANT: The number can be 0 or one greater than or equal to 1025 up to 65535.
Search on this list of ports for one that is available and does not conflict with another service- GetIfChanged (ForceRaiseStatus As Boolean)
Update IPs variable
Default: False. If ForceRaiseStatus is True, raise event ConnectionStatusChanged whether the IP has changed or not- Close
Close socket
- 1.00
- Release
- 1.01
- Add DependsOn XUI, iXUI and jXUI in manifest.txt file
Implementation Summary:
Sub Class_Globals
Private iSts As InetStatus
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
iSts.Initialize(Me, "CheckStatus")
iSts.Start(0)
End Sub
Private Sub CheckStatus_SocketStarted (Port As Int)
Log(Port.As (String))
End Sub
Private Sub CheckStatus_ConnectionStatusChanged (IPStatus As tpeIPs)
Log("Connected? " & IPStatus.IsConnected.As (String))
Log("Type " & IPStatus.ConnType)
Log("IP " & IPStatus.IP)
End Sub
Private Sub CheckStatus_Error (Msg As String)
Log(Msg)
End Sub
B4I | B4A | B4J |
|
Attachments
Last edited: