Mám prosbu nedávno jsme zde řešil problám s UDP na WINDOWS IOT, nic méně rady mně moc pomohly ale zasekl jsme se zase asi na uplné blbosti. Dal jsme dokupy terstovací kód viz níže. problém je vtom že jakmile dojde k provedení "i = server.Receive(bytes)" aplikace se kousne. Můžiu poprosít zase o popostrčení o krok dále ? Moc díky...
Sub test_sub_2()
Dim bindAddress As IPAddress = IPAddress.Any
Dim udpSocket As New Socket(bindAddress.AddressFamily, SocketType.Dgram, ProtocolType.Udp)
Dim remoteEndPoint As New IPEndPoint(New IPAddress(0), 5150) ' (IPAddress.Any, 4444)
udpSocket.Bind(remoteEndPoint)
test_2(udpSocket)
End Sub
Function test_2(server As Socket)
Dim msg As Byte() = Encoding.UTF8.GetBytes("This is a test")
Dim bytes(255) As Byte
Try
' Blocks until send returns.
Dim i As Integer
' i = server.Send(msg)
' Get reply from the server.
i = server.Receive(bytes)
UDPListBox.Items.Add(Encoding.UTF8.GetString(bytes))
Catch e As SocketException
UDPListBox.Items.Add(e.Message)
End Try
Return 0
End Function
|