Android Question Network problem

sseaand

Member
Licensed User
Longtime User
I'm having a problem with the Network library, after initializing the socket and connecting to the specified server: port parameters, the connection occurs but the application throws an error. Why the error?
B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim Net As Socket
    Dim Net_Ip As ServerSocket
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    
    Private EditText1 As EditText
    Private My_IP As Label
    Private Button1 As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    Activity.LoadLayout("Connect_Server")
    Net.Initialize ("Net")
    Net_Ip.Initialize(55554,Net_Ip)
    My_IP.Text=Net_Ip.GetMyIP

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub Button1_Click
    Net.Connect(EditText1.Text,55555,0)
    
End Sub
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top