AT\r\n
AT\r\n
ATE0\r\n
AT+CPIN?\r\n
AT+CEREG?\r\n
AT+MIPCLOSE=0\r\n 先尝试关闭0号socket,不需要判断返回
AT+MIPOPEN=0,"TCP","47.92.31.46",10002\r\n 使用0号socket连接TCP服务器, 服务器地址47.92.31.46(也可以填写域名,域名由于内部需要先DNS域名解析,所以需要等待约8S才可以连接), 服务器端口号 10002
AT+MIPSEND=0,5\r\n 告诉模组我要使用0号socket发送5字节数据
等待模组返回 >
发送要发送的5字节数据: 11111 (也可以填写16进制数)
模块接收数据,假设0号socket接收到16字节
+MIPURC: "rtcp",0,16,1111111111111111
AT+MIPOPEN=0,"TCP","47.92.31.46",10002,5,0,1000\r\n //指定本地端口号为1000
AT+MIPOPEN=1,"TCP","47.92.31.46",10002\r\n 使用1号socket连接TCP服务器
AT+MIPSEND=1,5\r\n 告诉模组我要使用1号socket发送5字节数据
等待模组返回 >
发送要发送的5字节数据: 11111 (也可以填写16进制数)
模块接收数据,假设1号socket接收到16字节
+MIPURC: "rtcp",1,16,1111111111111111
+MIPURC: "disconn",0,3 //如果0号客户端断开返回
AT+MIPSTATE=0 //可以使用此指令查询状态; 查询0号socket
模组正常连接返回
+MIPSTATE: 0,"TCP","47.92.31.46",10002,"CONNECTED"
OK
模组没有连接返回
+MIPSTATE: 0,,,,"INITIAL"
OK
AT\r\n
AT\r\n
ATE0\r\n
AT+CPIN?\r\n
AT+CEREG?\r\n
AT+MIPCLOSE=0\r\n 先尝试关闭0号socket,不需要判断返回
AT+MIPOPEN=0,"UDP","47.92.31.46",10002\r\n 使用0号socket连接UDP服务器, 服务器地址47.92.31.46(也可以填写域名), 服务器端口号 10002
AT+MIPSEND=0,5\r\n 告诉模组我要使用0号socket发送5字节数据
等待模组返回 >
发送要发送的5字节数据: 11111 (也可以填写16进制数)
模块接收数据,假设0号socket接收到16字节
+MIPURC: "rudp",0,16,1111111111111111
AT\r\n
AT\r\n
ATE0\r\n
AT+CPIN?\r\n
AT+CEREG?\r\n
AT+MQTTDISC=0\r\n 先尝试关闭0号,不需要判断返回
AT+MQTTCONN=0,"47.92.31.46",1883,"clentid","yang","11223344"\r\n 使用0号连接(支持0-5,6路), 服务器地址47.92.31.46(也可以填写域名), 服务器端口号 1883 用户名:yang 密码:11223344
注意:域名由于内部需要先DNS域名解析,所以需要等待约10S才可以连接
AT+MQTTSUB=0,"mqttsub",1\r\n //订阅主题
AT+MQTTPUB=0,"mqttpub",0,0,0,5\r\n //发布5字节消息
等待模组返回 >
发送要发送的5字节数据: 11111 (也可以填写16进制数)
//接收消息格式,接收6字节 111111
+MQTTURC: "publish",0,0,"mqttsub",6,6,111111
//接收消息格式,接收8字节 11111111
+MQTTURC: "publish",0,0,"mqttsub",8,8,11111111
AT+MQTTSUB=0,"mqttsub1",1,"mqttsub2",2\r\n //订阅多个主题,消息等级为1,2
AT+MPING="www.baidu.com"\r\n
+MPING: 0,"2409:8C54:870:34E:0:FF:B024:1916",16,60,49
[12:19:52.019]收←◆ +MPING: 0,"2409:8C54:870:34E:0:FF:B024:1916",16,60,49
[12:19:52.099]收←◆ +MPING: 0,"2409:8C54:870:34E:0:FF:B024:1916",16,75,49
[12:19:52.180]收←◆ +MPING: 0,"2409:8C54:870:34E:0:FF:B024:1916",16,75,49
+MPING: "statistics",4,0,60,75,67
AT+MDNSGIP="www.baidu.com"\r\n
+MDNSGIP: "www.baidu.com","2409:8C54:870:34E:0:FF:B024:1916","2409:8C54:870:67:0:FF:B0C2:AD75","120.232.145.185","120.232.145.144"
.