gpt4 book ai didi

c# - 从GNSS接收器读取UDP数据报

转载 作者:行者123 更新时间:2023-12-03 12:07:45 24 4
gpt4 key购买 nike

我正在尝试将来自Airlink MP70 GNSS网关的位置数据读取到模拟控制台应用程序中。 GNSS语句通过以太网和UDP发送到我的计算机。

网关IP:192.168.13.31(GNSS接收器)
源端口:17335

目标IP:192.168.13.100
港口:12351

我可以看到Wireshark的UDP数据报。突出显示的区域是我尝试提取的GNSS数据。

enter image description here

我将如何将这些数据接收到基本的控制台应用程序中,最好是C#,但c++/java python也可以。

这是到目前为止的内容,但是没有看到任何输出(这只是Microsoft C#站点上UDP客户端的基本代码)。

 private const int listenPort = 12351;

public static void Main()
{
UdpClient receivingUdpClient = new UdpClient(listenPort);

//Creates an IPEndPoint to record the IP Address and port number of the sender.
// The IPEndPoint will allow you to read datagrams sent from any source.
IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0);
try
{

// Blocks until a message returns on this socket from a remote host.
Byte[] receiveBytes = receivingUdpClient.Receive(ref RemoteIpEndPoint);

string returnData = Encoding.ASCII.GetString(receiveBytes);

Console.WriteLine("This is the message you received " +
returnData.ToString());
Console.WriteLine("This message was sent from " +
RemoteIpEndPoint.Address.ToString() +
" on their port number " +
RemoteIpEndPoint.Port.ToString());
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}

最佳答案

我的坏-是防火墙阻止了连接。感谢那些帮助的人

关于c# - 从GNSS接收器读取UDP数据报,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61770311/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com