CGDCONTzzz13com
zzz13com 时间:2021-03-24 阅读:(
)
SkywireDevelopmentKitSocketDialExampleNimbeLinkCorpUpdated:August2019PN30050rev10NimbeLinkCorp.
2019.
Allrightsreserved.
1TableofContentsTableofContents2Introduction3Prerequisites3SocketDial4Overview4SetupAPN(IfApplicable)4ConfigureSocket(IfApplicable)5ActivateSkywireSocket5InitiateSocketDial6SendDataviaHTTP7ReceiveDataviaHTTP7ShutdowntheSocketConnection8WorkingExample1:dweet.
io9Overview9GetIMEIofModem9InitiateSocketDial9SendDataviaHTTP10ReceiveDataviaHTTP10Troubleshooting11NewLine/CarriageReturn11Appendix-SocketDialFlowCharts12Introduction12NL-SW-HSPAFlowChart13NL-SW-LTE-TSVG-xFlowChart14PN30050rev10NimbeLinkCorp.
2019.
Allrightsreserved.
21.
Introduction1.
1.
PrerequisitesThisdocumentassumesyouhavecompletedtheinitialsetupofyourmodemanddevelopmentkit.
Ifyouhavenotcompletedthosesteps,refertotheSkywireDevelopmentKitUserManualandcompletethemodemsetupbeforeproceeding.
Ifapplicable,themodemmustalreadybeprovisioned.
SeetheDevelopmentKitUserManualfordetailsonhowtoaccomplishthesesteps.
Note:IfyourSkywiremodemisnotlistedhere,pleasevisititsrespectivepageonwww.
nimbelink.
comforthesocketdialprocedure.
PN30050rev10NimbeLinkCorp.
2019.
Allrightsreserved.
32.
SocketDial2.
1.
OverviewSocketdialingisusefulforuploadingordownloadinginformationtoorfromawebsiteordatabaseviaHTTPcommands.
Belowisanexampleforconnectingtoaserver,uploadingdata,downloadingdata,andthendisconnectingfromtheserver.
2.
2.
SetupAPN(IfApplicable)Forthefollowingmodems:-NL-SW-GPRS-NL-SW-HSPA-NL-SW-HSPA-B-NL-SW-LTE-TEUG-NL-SW-LTE-TNAG-NL-SW-LTE-TNAG-B-NL-SW-LTE-TC4EU-NL-SW-LTE-TC4NAG(AT&TFirmware)typethefollowingcommandintotheterminalprogram:AT+CGDCONT=1,"IP","[yourapn]"where[yourapn]istheAPNforyourcarrier,followedbytheEnterkey.
Theterminalshouldrespondwith:OKForexample,ifyouareusinganAT&TSIMandyourAPNis:iot0718.
com.
attzyouwouldtype:AT+CGDCONT=1,"IP","iot0718.
com.
attz"followedbytheEnterkey.
PN30050rev10NimbeLinkCorp.
2019.
Allrightsreserved.
4Forthefollowingmodem:-NL-SW-LTE-TSVG-NL-SW-LTE-TC4NAG(VerizonFirmware)typethefollowingcommandintotheterminalprogram:AT+CGDCONT=3,"IP","[yourapn]"where[yourapn]istheAPNforyourcarrier,followedbytheEnterkey.
Forexample,ifyourVerizonAPNis:nimblink.
gw12.
vzwentpyouwouldtype:AT+CGDCONT=3,"IPV4V6","nimblink.
gw12.
vzwentp"followedbytheEnterkey.
2.
3.
ConfigureSocket(IfApplicable)Forthefollowingmodem:-NL-SW-LTE-TSVG-NL-SW-LTE-TC4NAGtypethefollowingcommandintotheterminalprogram:AT#SCFG=1,3,300,90,600,50followedbytheEnterkey,andtheterminalshouldrespondwith:OKSinceVerizonmodemsusePDPContext3,thissetupisrequiredtousePDPcontext3withthefirstsocket.
2.
4.
ActivateSkywireSocketForthefollowingmodems:-NL-SW-1xRTT-A-NL-SW-1xRTT-S-NL-SW-1xRTT-V-NL-SW-EVDO-A-NL-SW-EVDO-V-NL-SW-GPRS-NL-SW-HSPA-NL-SW-HSPA-BPN30050rev10NimbeLinkCorp.
2019.
Allrightsreserved.
5-NL-SW-LTE-TEUG-NL-SW-LTE-TNAG-NL-SW-LTE-TNAG-B-NL-SW-LTE-TC4EU-NL-SW-LTE-TC4NAG(AT&TFirmware)typethefollowingcommandintotheterminalprogram:AT#SGACT=1,1followedbytheEnterkey,andtheterminalshouldrespondwith:#SGACT:"www.
xxx.
yyy.
zzz"OKwherewww.
xxx.
yyy.
zzzistheIPaddressofyourSkywiremodem.
Forthefollowingmodem:-NL-SW-LTE-TSVG-NL-SW-LTE-TC4NAG(VerizonFirmware)typethefollowingcommandintotheterminalprogram:AT#SGACT=3,1FollowedbytheEnterkey,andtheterminalshouldrespondwith:#SGACT:"www.
xxx.
yyy.
zzz"OKwherewww.
xxx.
yyy.
zzzistheIPaddressofyourSkywiremodem.
2.
5.
InitiateSocketDialIntheterminalprogram,typethefollowingcommand:AT#SD=1,0,80,"example.
com"where1isthesocketyouwouldliketoconnectwith(1–6),0isthetransmissionprotocolyou'dliketouse(0–TCP,1–UDP),80istheportnumberyou'dliketoconnectto(1–65535),andexample.
comisthehostnameorIPaddressyou'dliketoconnectto,followedbytheenterkey.
Afterashortdelaytheterminalprogramshouldrespondwith:CONNECTandthecursorwillbeonthenextline.
Note:Forthesocketnumber,usethesocketyousetupinSection2.
3above.
PN30050rev10NimbeLinkCorp.
2019.
Allrightsreserved.
6Note:TheTCPport(thirdparameter)thatistypicallyusedisport80,whichistheTCPPortforHTTP.
Dependingonyourapplication,youmayuseadifferentport.
2.
6.
SendDataviaHTTPInordertosenddatatothewebsite,youcanusetheHTTPPOSTcommand.
ThesyntaxofthePOSTcommandisasfollows:POST/test/demo_form.
aspHTTP/1.
1POSTistheHTTPcommandbeingissued,/text/demo_form.
aspistheendpointontheserver,andHTTP/1.
1istheHTTPversionyouwillbeusing.
Note:Forthisstep,youwillnotbeabletoseethetextyouaretyping.
Toensurethatthedataisaccurate,itisrecommendedtocopyandpasteinthedata.
However,thisisnotnecessary.
Intheterminalprogram,enterthePOSTdatayouwouldliketosendaccordingtotheabovesyntax.
Makesurethatthedataisformattedtohowyourserverisexpectingit.
Onceyoutypethedata,pressCTRL+MCTRL+JCTRL+MCTRL+J.
Thiswillenterthetwosetsofcarriagereturn/newlinecharactersnecessarytosignaltotheserverthatdatatransmissioniscomplete.
Afterashortdelay,theterminalprogramshoulddisplay:HTTP/1.
12xxOK[textresponsefromserver]NOCARRIERwhere2xxisthesuccessfulresponsecodeoftheHTTPserver.
200isthegeneralHTTP/1.
1responseofOK,meaningthattheresponsewasreceivedproperly.
Therearederivationsofthe2xxresponse,however.
Ifyoureceiveanunexpectedvalue,pleaseconsulttheHTTP/1.
1ProtocolDocumentationatthefollowingURL:http://www.
w3.
org/Protocols/rfc2616/rfc2616-sec10.
html2.
7.
ReceiveDataviaHTTPInordertoreceivedatafromawebsite,youmustusetheHTTPGETcommand.
ThesyntaxoftheGETcommandissimilartothePOSTcommand,andisasfollows:GET/test/demo_form.
aspHTTP/1.
1whereGETistheHTTPcommandbeingissued,/text/demo_form.
aspisthelocationofthedata,andHTTP/1.
1istheHTTPversionyouwillbeusing.
PN30050rev10NimbeLinkCorp.
2019.
Allrightsreserved.
7Note:Forthisstep,youwillnotbeabletoseethetextyouaretyping.
Toensurethatthedataisaccurate,itisrecommendedtocopyandpasteinthedata.
However,thecommandstillworksiftypedcorrectly.
Intheterminalprogram,entertheGETdatayouwouldliketorequestaccordingtotheabovesyntax.
Makesurethatthedataisformattedtohowyourserverisexpectingit.
Onceyoutypethedata,pressCTRL+MCTRL+JCTRL+MCTRL+J.
Thiswillenterthetwosetsofcarriagereturn/newlinecharactersnecessarytosignaltotheserverthatdatatransmissioniscomplete.
Afterashortdelay,theterminalprogramshoulddisplay:HTTP/1.
1xxxOK[textresponsefromserver]NOCARRIERwhere2xxisthesuccessfulresponsecodeoftheHTTPserver.
200isthegeneralHTTP/1.
1responseofOK,meaningthattheresponsewasreceivedproperly.
Therearederivationsofthe2xxresponse,however.
Ifyoureceiveanunexpectedvalue,pleaseconsulttheHTTP/1.
1ProtocolDocumentationatthefollowingURL:http://www.
w3.
org/Protocols/rfc2616/rfc2616-sec10.
html2.
8.
ShutdowntheSocketConnectionIntheterminalprogram,typethefollowingcommand:+++followedbytheEnterkey,andtheterminalshouldrespondwith:NOCARRIERThiscommand(threeplussigns)istheescapecommandtosuspendthedataconnectioninthesocketconnection.
Toclosethesocket,typethefollowingcommandintotheterminalprogram:AT#SH=xwherexisthesocketopenedintheprevioussteps,followedbytheenterkey,andtheterminalshouldrespondwith:OKThedataconnectionandsocketconnectionhasnowbeenterminated.
PN30050rev10NimbeLinkCorp.
2019.
Allrightsreserved.
83.
WorkingExample1:dweet.
io3.
1.
OverviewThissectionwillprovideaworkingexampleofsendingandreceivingdataviaanHTTPtransferusingaSkywireNL-SW-LTE-TSVGmodemusinga4GVerizonLTESIM.
dweet.
ioisalightweightmessagingservicespecificallydesignedforIoT(InternetofThings)devices.
Inadditiontobeinglightweight,dweet.
iodoesnotrequireanaccounttogetupandrunning.
Atwww.
dweet.
io,theyhaveanexcellent"helloworld"examplewewillbeusing.
3.
2.
GetIMEIofModemdweet.
iorequiresauniquedevicenameinordertosendandreceivedata.
Forthis,wewillbeusingtheIMEIofourmodem,whichisuniquetoourmodem.
TodisplaytheIMEI,typethefollowingcommandintotheterminalprogram:AT+GSNfollowedbytheEnterkey,andtheterminalwillrespondwithsomethingsimilarto:xxxxxxxxxxxxxxxOKThenumbershouldbeidenticaltotheIMEIprintedonthetopofthemodemlabel.
3.
3.
InitiateSocketDialUsingthesyntaxdescribedinSection2.
3,typethefollowingcommandintotheterminalprogram:AT#SD=1,0,80,"dweet.
io"followedbytheenterkey,andtheterminalprogramshouldrespondwithCONNECTInthiscase,1isthesocketweareusingontheSkywiremodem,0meansweareusingtheTCPtransmissionprotocol,80istheTCPportweareusing(TCPport80isusedforHTTP),anddweet.
ioisthehostnameweareconnectingto.
PN30050rev10NimbeLinkCorp.
2019.
Allrightsreserved.
93.
4.
SendDataviaHTTPUsingthesyntaxdescribedinstep2.
4,enterthefollowingcommandintotheterminalprogram:POST/dweet/for/xxxxxxxxxxxxxxxhello=worldHTTP/1.
1wherethestringofx'sisyourIMEIfromsetup3.
2,followedbytheenterkey.
PressCTRL+MCTRL+JCTRL+MCTRL+J,andafterashortdelaytheterminalprogramshouldrespondwithsomethingsimilarto:HTTP/1.
1200OKAccess-Control-Allow-Origin:*Content-Type:application/jsonContent-Length:150Date:[today'sdate]Connection:keep-alive{"this":"succeeded","by":"dweeting","the":"dweet","with":{"thing":"xxxxxxxxxxxxxxx","created":"[today'sdate]","content":{"hello":"world"}}}wherexxxxxxxxxxxxxxxisyourIMEI.
Bygoingtothewebsitehttps://dweet.
io/get/latest/dweet/for/xxxxxxxxxxxxxxx,replacingthex'sattheendwithyourIMEI,youwillseethefollowingtext:{"this":"succeeded","by":"getting","the":"dweets","with":[{"thing":"xxxxxxxxxxxxxxx","created":"[today'sdate]","content":{"hello":"world"}}]}Thistextisthesameasthetextatthebottomoftheterminalresponse,indicatingasuccessfulHTTPtransaction.
3.
5.
ReceiveDataviaHTTPUsingthesyntaxdescribedinstep2.
5,enterthefollowingcommandintotheterminalprogram:GET/get/latest/dweet/for/xxxxxxxxxxxxxxxwherethestringofx'sisyourIMEIfromsetup3.
2,followedbytheenterkey.
PressCTRL+MCTRL+JCTRL+MCTRL+J,andafterashortdelaytheterminalprogramshouldrespondwithsomethingsimilarto:HTTP/1.
1200OKPN30050rev10NimbeLinkCorp.
2019.
Allrightsreserved.
10Access-Control-Allow-Origin:*Content-Type:application/jsonContent-Length:152Date:[today'sdate]Connection:keep-alive{"this":"succeeded","by":"getting","the":"dweets","with":[{"thing":"xxxxxxxxxxxxxxx","created":"[today'sdate]","content":{"hello":"world"}}]}wherexxxxxxxxxxxxxxxisyourIMEI.
ThisindicatesthatwesuccessfullyreceivedtheHTTPinformation.
4.
Troubleshooting4.
1.
NewLine/CarriageReturnIfCTRL+MCTRL+Jdoesnotinsertthenecessarynewline/carriagereturncharacters,orifyourterminalprogramhandlesnewlinesdifferently,trypressingCTRL+JonlyinsteadofCTRL+MCTRL+J.
PN30050rev10NimbeLinkCorp.
2019.
Allrightsreserved.
115.
Appendix-SocketDialFlowCharts5.
1.
IntroductionNimbeLinkhascreatedexampleflowchartsforthesocketdialprocess,aswellaswhattodointheeventofafailure.
NimbeLinkrecommendsataminimumfollowingthesechartsandimplementingthenecessaryerrorhandling.
PleaseseetherespectiveATcommandmanualformoreinformationonATcommands.
PN30050rev10NimbeLinkCorp.
2019.
Allrightsreserved.
125.
2.
NL-SW-HSPAFlowChartPN30050rev10NimbeLinkCorp.
2019.
Allrightsreserved.
135.
3.
NL-SW-LTE-TSVG-xFlowChartPN30050rev10NimbeLinkCorp.
2019.
Allrightsreserved.
14
老薛主机怎么样?老薛主机这个商家有存在有一些年头。如果没有记错的话,早年老薛主机是做虚拟主机业务的,还算不错在异常激烈的市场中生存到现在,应该算是在众多商家中早期积累到一定的用户群的,主打小众个人网站业务所以能持续到现在。这不,站长看到商家有在进行夏季促销,比如我们很多网友可能有需要的香港vps主机季度及以上可以半价优惠,如果有在选择不同主机商的香港机房的可以看看老薛主机商家的香港vps。点击进入...
无忧云怎么样?无忧云,无忧云是一家成立于2017年的老牌商家旗下的服务器销售品牌,现由深圳市云上无忧网络科技有限公司运营,是正规持证IDC/ISP/IRCS商家,主要销售国内、中国香港、国外服务器产品,线路有腾讯云国外线路、自营香港CN2线路等,都是中国大陆直连线路,非常适合免备案建站业务需求和各种负载较高的项目,同时国内服务器也有多个BGP以及高防节点。一、无忧云官网点击此处进入无忧云官方网站二...
VPSDime是2013年成立的国外VPS主机商,以大内存闻名业界,主营基于OpenVZ和KVM虚拟化的Linux套餐,大内存、10Gbps大带宽、大硬盘,有美国西雅图、达拉斯、新泽西、英国、荷兰机房可选。在上个月搞了一款达拉斯Linux系统VPS促销,详情查看:VPSDime夏季促销:美国达拉斯VPS/2G内存/2核/20gSSD/1T流量/$20/年,此次推出一款Windows VPS,依然是...
zzz13com为你推荐
沙滩捡12块石头价值近百万捡块石头价值一亿 到底是什么石头能价值一亿对对塔对对塔和魔方格那个是正宗的?安徽汽车网中国汽车十大品牌李子柒年入1.6亿李子柒男朋友是谁,李子柒父母怎么去世的?杰景新特杰德特这个英雄怎么样丑福晋八阿哥胤禩有几个福晋 都叫啥名儿呀网站检测请问论文检测网站好的有那些?同一服务器网站同一服务器上的域名/网址无法访问抓站工具一起来捉妖神行抓妖辅助工具都有哪些?dadi.tvapple TV 功能介绍
深圳主机租用 花生壳免费域名申请 东莞电信局 hkbn koss 网站保姆 空间服务商 godaddy域名证书 太原联通测速 net空间 东莞主机托管 稳定空间 云服务是什么意思 存储服务器 香港博客 accountsuspended 最新优惠 hosts文件修改 卡巴斯基免费下载 vim命令 更多