I want to parse the data from raspberry to server through WIFI connection the GUI server like pic below, but when I use timer to automatically parse data it won’t work automatically and I try to use button to trigger the parse data form Raspberry. What code should I attach to my GUI server to make it receive the data from raspberry and automatically parse it?

Name:  GUI Server.jpg
Views: 343
Size:  21.7 KB

This is the code
Code:
Imports System.Net
Imports System.Net.Sockets


Public Class Form1
    Dim TCPServer As Socket
    Dim TCPListener As TcpListener

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        TCPListener = New TcpListener(IPAddress.Any, 1000)
        TCPListener.Start()
        TCPServer = TCPListener.AcceptSocket()
        TCPServer.Blocking = False
        Timer1.Enabled = True
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick

        Try
            Dim rcvbytes(TCPServer.ReceiveBufferSize) As Byte
            TCPServer.Receive(rcvbytes)
            TextBox2.Text = System.Text.Encoding.ASCII.GetString(rcvbytes)
            Timer2.Enabled = True
        Catch ex As Exception
        End Try
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim sendbytes() As Byte = System.Text.Encoding.ASCII.GetBytes(TextBox1.Text)
        TCPServer.Send(sendbytes)
    End Sub

    Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
        Dim S As String

        S = TextBox2.Text + "," + "," + "," + ""
        Dim somestring() As String
        somestring = S.Split(New Char() {","c})

        TextBox3.Text = somestring(0)
        TextBox4.Text = somestring(1)
        TextBox2.Text = ""
    End Sub
End Class