Sub Globals
Dim Sock_WiFi As Socket
Dim Btn_WiFi As Button ' Button on layout
Dim AStream As AsyncStreams
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
Sock_WiFi.Initialize("Sock_WiFi")
End If
End Sub
Sub Btn_WiFi_Click ' When clicking on button on layout
Sock_WiFi.Connect(IpAddress, Int_PortNr, 10000)
AStream.Initialize(Sock_WiFi.InputStream, Sock_WiFi.OutputStream, "AStream")
End Sub
Sub Sock_WiFi_Connected(Successful As Boolean)
' Send data with AStream.Write(...)
End Sub
Sub AStream_NewData(Buffer() As Byte)
' Receive data
End Sub