1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| Private Sub Nav_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim t As New Thread(AddressOf ReceiveLoop)
t.Start()
End Sub
Private Sub ReceiveLoop()
Dim receivingUdpClient As New UdpClient(900)
Dim RemoteIpEndPoint As New IPEndPoint(IPAddress.Any, 0)
Wile True
Dim receiveBytes As [Byte]() = receivingUdpClient.Receive(RemoteIpEndPoint)
Dim returnData As String = Encoding.Default.GetString(receiveBytes)
Invoke(AddressOf UpdateText, returnData.ToString())
End While
End Sub
Private Sub UpdateText(Dim txt As String)
TxtEtat.Text = txt
End Sub |