Android Question [Resolved]Socket Response

Douglas Farias

Expert
Licensed User
Longtime User
Hi i make this to check the ports of my vps ip

B4X:
Sub btporta_Click
    Socket1.Connect(ipporta.Text,porta.Text,3000)
End Sub

here is how i get the response
B4X:
Sub Socket1_Connected(Connected As Boolean)As Boolean
  If Connected Then
      Msgbox("Port OK","")
      Socket1.Close
      Return True
  Else
    Msgbox("Port Closed!", "")
    Socket1.Close
        Return True
  End If
End Sub

in the 1° time this works fine, port 80 = PORT OK

but whan i try execute
Socket1.Connect(ipporta.Text,porta.Text,3000)
again i have port closed all time o_O

why this works only 1 time?, i have try use socket.close but dont work too *-*

1 time = port OK
later 1 time = port closed
 

Douglas Farias

Expert
Licensed User
Longtime User
Fixed need to initializate again

B4X:
Sub btporta_Click
    Socket1.Initialize("Socket1")
    Socket1.Connect(ipporta.Text,porta.Text,3000)
End Sub
 
Upvote 0
Top