我可以在RESTful服务中使用TCP吗? [英] Can I use TCP in a RESTful service?

查看:115
本文介绍了我可以在RESTful服务中使用TCP吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

REST正在使用Web的当前功能,并在其上应用一些原理以使其更加高效。它使用标准的HTTP动词进行通信,并利用其无状态特性。

REST is using current features of the Web and applying some principles on it to make it more efficient. It uses standard HTTP verbs for communication and take help of its stateless nature.

但是,REST服务是否可能使用TCP协议进行通信?如果是,那会违反其原则吗?

However, is it possible that a REST service use the TCP protocol for its communication? If yes, then will it violate its principles?

推荐答案

HTTP是基于TCP / IP的协议。因此,当您使用REST时,您已经在使用TCP进行通信。但是,如果您想在没有HTTP的情况下在纯TCP套接字上使用REST,则没有,这没有任何意义,因为REST基于HTTP动词和标头。这些概念仅存在于HTTP协议中。

HTTP is a TCP/IP based protocol. So when you use REST you are already using TCP for communication. But if you want to use REST over pure TCP socket, without HTTP, then no, this doesn't make sense because REST is based on HTTP verbs and headers. Those notions exist only in the HTTP protocol.

这篇关于我可以在RESTful服务中使用TCP吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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