与 gRPC 的 P2P 连接

发布于 2025-01-14 18:07:54 字数 94 浏览 6 评论 0原文

我目前正在 C# ASP.NET 中使用 gRPC 服务开发 P2P 服务。 我知道整个过程是如何工作的,但是有没有一种方法可以启用服务器和客户端,以便他可以接收和发布消息?

I'm currently working on a P2P Service with the gRPC Service in C# ASP.NET.
I know how the whole process works but is there a way to enable server and client for one so that he can receive and also post messages?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

予囚 2025-01-21 18:07:54

gRPC 有客户端和服务器的概念。

只有客户端发起与服务器的连接,并且只有客户端可以对服务器发起 RPC 调用,但是,一旦客户端与服务器建立了连接,客户端就可以发送单个消息或消息流,并且服务器可以使用单个消息或消息流进行响应消息。

如果您想要真正的点对点,其中任何对等点都可以发起并响应来自任何其他对等点的 RPC,那么您需要在对等点中实现客户端服务器。

将“客户端”和“服务器”视为 gRPC 角色。

gRPC has concepts of client and server.

Only clients originate connections to to servers and only clients can initiate RPC calls against servers but, once a client has established a connection to a server, the client can send a single or stream of messages and the server can respond with a single or stream of messages.

If you want true peer-to-peer in which any peer can originate and respond to RPCs from any other peer, then you need to implement both a client and a server in the peer.

Think of "client" and "server" more like gRPC roles.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文