HTTP与TCP / IP,将数据发送到Web服务器 [英] HTTP vs TCP/IP, send data to a web server

查看:330
本文介绍了HTTP与TCP / IP,将数据发送到Web服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开展一个项目,我需要使用Arduino Nano( http:// arduino .cc / en / Main / arduinoBoardNano )将数据从温度传感器发送到网络服务器。



起初我认为这很容易,因为有很多伟大的图书馆可以帮助POST / GET等。但是,我的教授告诉我,我需要使用TCP / IP将数据发送到服务器,据我所知,POST和GET是HTTP方法。 / p>

有人可以向我解释HTTP和TCP / IP之间的区别吗?特别是因为它涉及将数据发送到Web服务器。我正在寻找一个不太技术性的答案(我对这一切都很陌生)。



最后,如果有人有经验让Arduino做我上面所描述的,我真的很感激一些指示。



谢谢!

解决方案

HTTP是一种主要用于浏览互联网(IE,Firefox等)的协议。它位于TCP之上,它在两台计算机之间提供可靠的链接(如果数据包丢失 - 它会被重新传输)。 TCP本身就位于IP之上,它为计算机之间的通信提供统一寻址。 TCP / IP是互联网和99%其他网络的基础。



基本上,这意味着如果你正在通信HTTP,你正在使用TCP / IP在下面(但是我相信这不是你教授的意思。)



Arduino Nano并不支持所有这些,所以你需要介于两者之间的东西,这会将Nano信号转换为TCP / HTTP通信。



有些选项是:


  1. 与Nano通信over Serial并让PC将您的串行协议转换为HTTP / TCP

  2. 使用支持以太网/ Wifi屏蔽扩展(Uno / Mega)的其他Arduino板切换Nano,或选择定制板包含以太网本身

  3. 使用带有以太网屏蔽的另一个Arduino(Uno / Mega)作为附加板,通过串口或借助RF模块与Nano通信(我个人在过去)

  4. 另一个不寻常的选择是将Nano连接到你的Andro id智能手机使用音频线并使用软调制解调器库( https://code.google.com / p / arms22 / issues / detail?id = 2 ),其中包含Android的实现并为Android编写应用程序

您提到的Web服务器仅按定义支持HTTP,因此如果您想通过TCP进行通信,则需要使用某些TCP服务器。



提供用于可视化传感器数据的图表的现有Web服务之一是 https:// xively。 com / ,它基于REST,它基于HTTP。但它不是唯一的。


I'm currently working on a project where I need to use an Arduino Nano (http://arduino.cc/en/Main/arduinoBoardNano) to send data from a temperature sensor to a web server.

At first I thought it would be easy, since there are so many great libraries out there to help with POST/GET etc. However, my professor just told me that I need to send data to the server using TCP/IP, and as I understand it POST and GET are HTTP methods.

Could someone explain to me the difference between HTTP and TCP/IP? Specifically as it relates to sending data to a web server. I'm looking for an answer that isn't too technical (I'm pretty new to all of this).

Finally, if there is anyone out there with experience making an Arduino do what I've described above, I would really appreciate some pointers.

Thanks!

解决方案

HTTP is a protocol used mostly for browsing the internet (IE, Firefox, etc). It rides on top of TCP which provides a reliable link between two computers (if packet get lost - it is re-transmitted). TCP itself rides on top of IP, which provides unified addressing to communicate between computers. TCP/IP is a basis for internet and 99% of other networks.

Basically it means if you are communicating HTTP, you are doing it with TCP/IP underneath (but I am sure this is not what your professor meant).

Arduino Nano is not supporting all of those, so you need something in between, which will translate Nano signalling to TCP/HTTP communication.

Some of you options are:

  1. Communicating with Nano over Serial and making PC translate your Serial protocol to HTTP/TCP
  2. Switch Nano with some other Arduino board which supports Ethernet/Wifi shield extension (Uno/Mega), or choosing a custom board which contains Ethernet by itself
  3. Using another Arduino (Uno/Mega) with Ethernet shield as an additional board which communicates with Nano over Serial or with the help of RF modules (I personally implemented this option in past)
  4. Another unusual option is to attach Nano to your Android smartphone using Audio cable and to use soft-modem library (https://code.google.com/p/arms22/issues/detail?id=2), which contains implementation for Android and write an application for Android

Web server you mention supports HTTP only by definition, so if you want to communicate over TCP, you will need to use some TCP server.

One of the existing web services to provide graphs for visualizing Sensor data is https://xively.com/, it API is based on REST which rides on top of HTTP. But it is not the only one.

这篇关于HTTP与TCP / IP,将数据发送到Web服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆