Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
329 views
in Technique[技术] by (71.8m points)

http - 是否可以通过CoAP传输文件?(Is it possible to transfer a file through CoAP?)

Recently, I am doing a project and I am trying to transfer a json file to the CoAP server.

(最近,我正在做一个项目,我正在尝试将json文件传输到CoAP服务器。)

I put some random values in key:value pairs such as:

(我在key:value对中放置了一些随机值,例如:)

{
    key1: value1,
    key2: [value21, value22, value23]
}

Questions:

(问题:)

  • CoAP is pretty much similar to HTTP.

    (CoAP与HTTP非常相似。)

    So, like HTTP, is it possible to transfer a json file through CoAP using POST/PUT method?

    (因此,就像HTTP一样,是否可以使用POST / PUT方法通过CoAP传输json文件?)

    If it is possible, what is the recommended directory location to put the uploaded file into the server ( resource directory)?

    (如果可能,将上传的文件放入服务器的推荐目录位置是什么( 资源目录)?)

Update:

(更新:)

The actual file size is about to 152.8 kB.

(实际文件大小约为152.8 kB。)

  ask by testuser translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can transfer arbitary JSON files using CoAP POST/PUT.

(您可以使用CoAP POST / PUT传输任意的JSON文件。)

Which directory would be writable depends fully on the server.

(哪个目录可写完全取决于服务器。)

Note that for a file of that size, transfer times would be considerably longer than with HTTP, as packages are sent in lock-step (putting the first 1kB, response, next 1kB – whereas HTTP has a TCP window).

(请注意,对于该大小的文件,传输时间将比HTTP更长,因为程序包以锁定步骤发送(输入第一个1kB,响应,下一个1kB – HTTP具有TCP窗口)。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...