与 gRPC 的 P2P 连接
我目前正在 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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.