• 欢迎大家分享资料!前往留言板评论即可!

720X系列模块 FTP常见用法

合宙 模组资料网 8个月前 (05-15) 113次浏览 已收录 0个评论 扫描二维码

本教程以720H模块,V1446固件为例,测试FTP常见的3大用法

1.模块上电开机后,基本查询如下:

[15:56:42.592]发→◇AT+CPIN? //查询模块SIM卡是否被识别
[15:56:42.594]收←◆AT+CPIN?
+CPIN: READY
OK
[15:56:53.270]发→◇AT+CSQ //查询模块信号强度
[15:56:53.273]收←◆AT+CSQ
+CSQ: 25,99
OK
[15:56:55.894]发→◇AT+CGATT?//查询模块是否附着网络
[15:56:55.898]收←◆AT+CGATT?
+CGATT: 1
OK

2.常见用法(已省略基本查询)

2.1 FTP GET

[15:57:00.582]发→◇AT+SAPBR=3,1,”CONTYPE”,”GPRS”
[15:57:00.585]收←◆AT+SAPBR=3,1,”CONTYPE”,”GPRS”
OK
[15:57:01.517]发→◇AT+SAPBR=3,1,”APN”,””
[15:57:01.520]收←◆AT+SAPBR=3,1,”APN”,””
OK
[15:57:02.366]发→◇AT+SAPBR=1,1
[15:57:02.371]收←◆AT+SAPBR=1,1
OK
[15:57:03.302]发→◇AT+SAPBR=2,1
[15:57:03.304]收←◆AT+SAPBR=2,1
+SAPBR: 1,1,”10.162.173.20″
OK
//以上为PDP激活过程
[15:57:06.326]发→◇AT+FTPCID=1
[15:57:06.331]收←◆AT+FTPCID=1
OK
[15:57:24.862]发→◇AT+FTPSERV=”XX.X.87.100″//设置服务器ip地址,也可以使用域名,测试以实际服务器为准
[15:57:24.868]收←◆AT+FTPSERV=”XX.X.87.100″
OK
[15:57:26.798]发→◇AT+FTPUN=”user”
[15:57:26.803]收←◆AT+FTPUN=”user”
OK
[15:57:28.950]发→◇AT+FTPPW=”123456″
[15:57:28.955]收←◆AT+FTPPW=”123456″
OK
//以上为FTP服务器基本参数设置
[15:57:29.450]发→◇AT+FTPGETPATH=”/”
[15:57:29.457]收←◆AT+FTPGETPATH=”/”//设置下载文件路径
OK
[15:57:31.062]发→◇AT+FTPGETNAME=”1223.txt”//设置服务器端目标文件的名称
[15:57:31.068]收←◆AT+FTPGETNAME=”1223.txt”
OK
[15:57:39.557]发→◇AT+FTPGET=1 //开始下载会话
[15:57:39.563]收←◆AT+FTPGET=1
OK
[15:57:40.516]收←◆
+FTPGET: 1,1 //必须等到这条上报,才能发下一条指令
[15:57:43.550]发→◇AT+FTPGET=2,1460//一次读入最多1460字节
[15:57:43.556]收←◆AT+FTPGET=2,1460
+FTPGET: 2,1460
When doctors think all of their patients are heterosexual, those who identify …………(此处省略若干数据)………… LGBTQ patients sho//这是读入的1460字节数据
OK
[15:57:48.286]发→◇AT+FTPGET=2,1460//如果目标文件大于1460字节,需要在第一次读完数据后,再次发送这条指令,读取下一部分数据,直至结束
[15:57:48.294]收←◆AT+FTPGET=2,1460
+FTPGET: 2,214
uld get the same quality of care other patients get. Increasing LGBTQ student enrollment in medical schools and training in LGBTQ health issues can help reach those goals, advocates say.
Research shows that patie//文件较小,本次读入214字节,已全部读完
OK
[15:57:59.871]收←◆
+FTPGET: 1,0 //提示会话结束
[15:58:35.726]发→◇AT+FTPQUIT
[15:58:35.733]收←◆AT+FTPQUIT
+CME ERROR: 3
//已上报+FTPGET: 1,0 表示会话已结束,所以, AT+FTPQUIT退出当前FTP会话 返回error3,属于正常。也 可 以 在 提 示+FTPGET: 1,0 前,主动用AT+FTPQUIT退出当前FTP会话 。

2.2 FTP PUT(举例:给同一文件PUT 2次数据,每次1360字节(1358字节+\r\n)

…………此处省略基本查询和PDP激活过程…………
[18:16:00.412]发→◇AT+FTPCID=1
[18:16:00.415]收←◆AT+FTPCID=1
OK
[18:16:03.612]发→◇AT+FTPSERV=”XX.X.87.100″
[18:16:03.615]收←◆AT+FTPSERV=”XX.X.87.100″
OK
[18:16:04.605]发→◇AT+FTPUN=”user”
[18:16:04.613]收←◆AT+FTPUN=”user”
OK
[18:16:05.541]发→◇AT+FTPPW=”123456″
[18:16:05.546]收←◆AT+FTPPW=”123456″
OK
//以上为FTP服务器基本参数设置
[18:16:26.604]发→◇AT+FTPPUTNAME=”HZ.txt”//设置上传文件的名称
[18:16:26.609]收←◆AT+FTPPUTNAME=”HZ.txt”
OK
[18:16:29.198]发→◇AT+FTPPUTPATH=”/11/”//设置上传文件的路径
[18:16:29.204]收←◆AT+FTPPUTPATH=”/11/”
OK
[18:16:31.229]发→◇AT+FTPPUT=1
[18:16:31.235]收←◆AT+FTPPUT=1
OK
[18:16:31.877]收←◆
+FTPPUT: 1,1,1360//必须等到这个上报
[18:16:34.117]发→◇AT+FTPPUT=2,1360//单次上传的最大长度为1360字节
[18:16:34.122]收←◆AT+FTPPUT=2,1360
+FTPPUT: 2,1360
[18:16:37.017]发→◇11111111111111111111111111111111111111111111111111111111111111………(此处省略若干字节)…………1111111111111111111111111111111111111111111111111111111111166
[18:16:37.032]收←◆
OK
+FTPPUT: 1,1,1360//第一次成功PUT 1360字节数据
[18:16:46.669]发→◇AT+FTPPUT=2,1360
[18:16:46.676]收←◆AT+FTPPUT=2,1360
+FTPPUT: 2,1360
[18:16:49.678]发→◇11111111111111111111111111111111111111111111111111111111111111…………(此处省略若干字节)…………11111111111111188
[18:16:49.695]收←◆
OK
+FTPPUT: 1,1,1360//给同一文件,第二次成功PUT 1360字节数据
[18:17:08.590]发→◇AT+FTPQUIT
[18:17:08.593]收←◆AT+FTPQUIT//主动结束FTP会话
OK
[18:17:08.639]收←◆
+FTPPUT: 1,86

2.3FTP下载 断点续传流程
2.3.1确认服务器支持断点续传
2.3.2流程如下

…………此处已省略模块开机基本查询和模块PDP激活过程…………
[18:56:53.795]发→◇AT+FTPCID=1
[18:56:53.801]收←◆AT+FTPCID=1
xxO
[18:56:56.442]发→◇AT+FTPSERV=”xx.x.87.100″
[18:56:56.447]收←◆AT+FTPSERV=”xx.x.87.100″
OK
[18:56:58.090]发→◇AT+FTPUN=”user”
[18:56:58.092]收←◆AT+FTPUN=”user”
OK
[18:56:59.794]发→◇AT+FTPPW=”123456″
[18:56:59.800]收←◆AT+FTPPW=”123456″
OK
[18:57:01.450]发→◇AT+FTPGETPATH=”/”
[18:57:01.457]收←◆AT+FTPGETPATH=”/”
OK
[18:57:09.402]发→◇AT+FTPGETNAME=”1223.txt”
[18:57:09.409]收←◆AT+FTPGETNAME=”1223.txt”
OK
[18:57:11.362]发→◇AT+FTPGET=1
[18:57:11.367]收←◆AT+FTPGET=1
OK
[18:57:12.340]收←◆
+FTPGET: 1,1
[18:57:17.906]发→◇AT+FTPGET=2,100
[18:57:17.912]收←◆AT+FTPGET=2,100
+FTPGET: 2,100
When doctors think all of their patients are heterosexual, those who identify in other ways can feel//成功下载100字节
OK
[18:57:26.557]收←◆
+FTPGET: 1,1
[18:57:27.866]发→◇AT+FTPQUIT//关闭会话
[18:57:27.872]收←◆AT+FTPQUIT
OK
[18:57:27.991]收←◆
+FTPGET: 1,86
[18:57:33.745]发→◇AT+FTPREST=101//设置下载节点为101字节,(此断点只要小于文档数据长度,可任意设置),表示模块此次会从101字节处开始下载
[18:57:33.751]收←◆AT+FTPREST=101
OK
[18:57:55.929]发→◇AT+FTPGET=1
[18:57:55.936]收←◆AT+FTPGET=1
OK
[18:57:56.577]收←◆
+FTPGET: 1,1
[18:58:21.071]收←◆
+FTPGET: 1,1
[18:58:24.089]发→◇AT+FTPGET=2,500//从101字节处开始下载,本次下载500字节
[18:58:24.093]收←◆AT+FTPGET=2,500
+FTPGET: 2,500
ignored. They also are less likely to seek medical care. This can lead to health problems including high rates of depression, suicidal behavior, alcohol and drug use and ineffective health screenings. That information comes from LGBTQ advocates in the United States. But changes are coming to the medical field, these advocates say. Feroe displays a button resembling a Harvard School of Medicine coat of arms lion, in rainbow colors that symbolize LGBTQ pride, left, and a button featuring pronou
OK
[18:58:31.069]收←◆
+FTPGET: 1,1
[18:58:45.233]发→◇AT+FTPQUIT
[18:58:45.236]收←◆AT+FTPQUIT//关闭会话
OK
[18:58:45.714]收←◆
+FTPGET: 1,86

3.备注

3.1模块ftp默认是被动模式,不支持主动模式,无法设置主动模式,公网下要想模块正常连接服务器,服务器肯定不能设置为主动模式,否则哪家模块都不能用。

转载请注明原文链接:720X系列模块 FTP常见用法
喜欢 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址