了解Apache Thrift与TCP套接字服务器的特性?(Understanding the characteristics of Apache Thrift versus TCP socket s

编程入门 行业动态 更新时间:2024-10-28 16:16:31
了解Apache Thrift与TCP套接字服务器的特性?(Understanding the characteristics of Apache Thrift versus TCP socket servers?)

我有一些使用OpenSSL编写TCP套接字服务器的经验,我希望了解有关Apache Thrift的更多信息。 我已经查看了Thrift服务器的一些基本示例,我知道Thrift可以处理管道。

有人能提供一个简单的解释Thrift服务器与TCP服务器的不同之处(除了使用管道)? Thrift框架是否使用不同的传输协议?

我知道这是一个简单的问题,但我似乎找不到初学者的解释。

I have some experience writing TCP socket servers using OpenSSL and I'm looking to understand more about Apache Thrift. I've looked over some basic examples of Thrift servers, and I understand that Thrift can handle pipes.

Can someone provide a simple explanation of the ways a Thrift server differs from a TCP server (apart from the use of pipes)? And do Thrift frameworks use a different transport protocol?

I know this is a straightforward question, but I can't seem to find a beginner level explanation.

最满意答案

[...] Thrift服务器与TCP服务器的不同之处?

Thrift至少是原始套接字上方的一个抽象层。 它为您提供了一个抽象,允许您通过任何介质发送和接收信息,其中一个介质可以是TCP套接字。

底层传输介质本身并不重要,也没有使用协议(二进制,紧凑,JSON ......你的名字)。 两者对您的应用程序的其余部分完全透明。

换句话说,您是针对类型安全的服务API开发的,而不是编写套接字或自己解析一些JSON。

Thrift不是摆弄字节,编码和对抗套接字的微妙之处,而是让您专注于您希望使用该服务作为客户端和/或实现服务器端逻辑。

另外,您可以根据需要更改传输和/或协议,而不会影响其余代码。

[...] ways a Thrift server differs from a TCP Server?

Thrift is at least one abstraction layer above raw sockets. It provides you with an abstraction which allows you to send and receive information across any medium, one of which could be TCP sockets.

The underlying transport medium itself is not important, nor is the protocol used (binary, compact, JSON ... you name it). Both is entirely transparent to the rest of your application.

In other words, you develop against a type-safe service API, rather than programming sockets or parse some JSON on your own.

Instead of fiddling around with bytes, encodings and fighting the subtleties of sockets, Thrift allows you to focus on what you want to do with that Service as a client and/or implementing the server-side logic.

Plus you may change transport and/or protocol as needed without affecting the rest of the code.

更多推荐

本文发布于:2023-07-26 19:20:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1279849.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:特性   服务器   Thrift   TCP   Apache

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!