Bug? Network Library Bug?

Computersmith64

Well-Known Member
Licensed User
Longtime User
I have written a sub that checks whether I have network connectivity - either via a local network, or a cell network:

B4X:
Sub Check_Connectivity() As Boolean
    Dim phDevice As Phone
    Dim sTCP As ServerSocket
   
    Try
        sTCP.Initialize(13132, "")
        If sTCP.GetMyIP <> "127.0.0.1" Then
            sTCP.Close
            Return True
        End If   
        sTCP.Close
       
        If phDevice.GetNetworkType <> "UNKNOWN" Then Return True
       
        Return False
    Catch
        Send_Error_Report("Check_Connectivity", LastException.Message)
        Return False
    End Try

The problem I am having is that I am receiving the following error report from a few of my users:

Yahtzee! Version: Version: 10.4 (Free)
SDK: 16
Sub: Check_Connectivity
Error: java.lang.NumberFormatException: Invalid int: " 4"
Timestamp: 01/27/2014 - 13:20:43

What I don't understand is where this "Invalid int:" is coming from. There are no int variables in the sub & none of the method calls take an int as a parameter, nor do they return an int. I also don't know where this " 4" value is coming from. Is this possibly a bug in the Network library, or am I missing something really obvious here?

Thanks,

Colin.
 

stevel05

Expert
Licensed User
Longtime User
You don't need the empty brackets after the Sub Check_Connectivity if there are no arguments. It's probably not the cause of the problem though.

A couple of questions, Do you know on which devices it fails? and what is the signature for the sub "Send_Error_Report"
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
You don't need the empty brackets after the Sub Check_Connectivity if there are no arguments. It's probably not the cause of the problem though.

A couple of questions, Do you know on which devices it fails? and what is the signature for the sub "Send_Error_Report"

Yeah - that's just the way I like to write my subs if they return a value. Don't know the answer to your first question (something I will have to include in my error reporting in the future), but I have had a few reports of the issue, so I'm assuming (possibly wrongly) that it's not a specific device.

The signature for the sub is:

B4X:
Sub Send_Error_Report(sSub As String, sError As String)

- although I don't think it's relevant as the exception itself is being generated in Check_Connectivity.

Thanks - Colin.
 
Top