Is there a DataInterval function similar to the Winsock control in VB6.0 in B4A, so that I can retrieve the content returned by the device.
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
Winsock1.GetData strData
If strData <> "" Then
MsgBox strData
End If
End Sub
If possible, can you directly modify it on the following code?
Private Sub ConnectToServer(Host As String)
Log("Trying to connect to: " & Host)
CloseExistingConnection
Dim client As Socket
client.Initialize("client")
client.Connect(Host, 8999, 10000)
Wait For Client_Connected (Successful As Boolean)
If Successful Then
Log("OK")
astream.InitializePrefix(client.InputStream, False, client.OutputStream, "astream")
UpdateState (True)
Else
Log("Failed to connect: " & LastException)
End If
End Sub