Sub Socket1_Connected (Successful As Boolean)
If Successful = False Then
lConnect.Text = "Not connected!"
Return
End If
lConnect.Text = "Connected!"
AStreams.Initialize(Socket1.InputStream, Socket1.OutputStream, "AStreams")
End Sub
Sub bSend_Click
If Socket1.Connected = False Then
ToastMessageShow("Not connected!", False)
Return
End If
Dim buffer() As Byte = eSend.Text.GetBytes("UTF8")
If AStreams.Write(buffer) == False Then ToastMessageShow("Data not written!",False)
End Sub
Sub AStreams_NewData (Buffer() As Byte)
Dim msg As String
msg = BytesToString(Buffer, 0, Buffer.Length, "UTF8")
lResult.Text = msg
End Sub