【发布时间】:2021-07-17 15:33:51
【问题描述】:
我正在尝试使用 SIM7020E 芯片上的 AT 命令通过 t-mobile NB-IoT 网络发送 UDP 数据包。我使用the product wiki 作为参考。我的sim卡的starter版本不支持TCP,但是如果我可以使用UDP成功通信,我打算稍后使用它。
我使用“nc -u -l 9999”在 Raspberry Pi 上创建了一个 UDP 套接字。我在我的托管服务提供商上设置了一个 A 记录,以将 dev.mydomain.com 引用到 Raspberry Pi 的 IP 地址。我通过使用“nc -u dev.mydomain.com 9999”从我的笔记本电脑在另一个网络上发送 UDP 数据包并输入一些测试字符串来验证端口转发和 A-record 设置,所以这一切都有效。
在 4G 芯片上,我使用以下 AT 命令:
// Check network
AT+CSQ
+CSQ: 21,0
AT+CGREG?
+CGREG: 0,5
AT+COPS?
+COPS: 0,2,"20416",9
AT+CGCONTRDP
+CGCONTRDP: 1,5,"iot.t-mobile.nl","x.x.x.x.255.255.255.0" <-- crossed out my ip
// Create UDP socket
AT+CSOC=1,2,1
+CSOC: 0
// Connect socket 0 to the listening port on the Raspberry Pi
AT+CSOCON=0,9999,"dev.mydomain.com"
OK
// Send "test"
AT+CSOSEND=0,0,"test"
此时我希望看到“test”出现在 Raspberry Pi 的命令行中,但没有任何反应。在 T-mobile 门户中,它显示 PDP 上下文已成功激活。
此外,使用 AT*MCGDEFCONT="IP","iot.t-mobile.nl","username","password" 手动设置 APN 也不起作用。
【问题讨论】:
标签: sockets udp at-command netcat nb-iot