如何实现双向“邮箱服务”通过 TCP?
这个想法是允许对等进程通过 tcp 尽可能异步地交换消息(数据包)。
我希望它的工作方式是每个进程都有一个发件箱和一个收件箱。发送操作只需按发件箱即可。接收操作只需在收件箱中弹出即可。底层协议将处理通信细节。
有没有办法使用单个 TCP 连接来实现这种机制?
如何使用 BSD 套接字和现代 OO 套接字 API(如 Java 或 C# 套接字 API)来实现这一点?
The idea is to allow to peer processes to exchange messages (packets) over tcp as much asynchronously as possible.
The way I'd like it to work is each process to have an outbox and an inbox. The send operation is just a push on the outbox. The receive operation is just a pop on the inbox. Underlying protocol would take care of the communication details.
Is there a way to implement such mechanism using a single TCP connection?
How would that be implemented using BSD sockets and modern OO Socket APIs (like Java or C# socket API)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,可以通过单个 TCP 连接来完成。举一个明显的例子,(尽管比您真正需要的更复杂一些)您可以看一下 NNTP 协议 (RFC 3977)。您似乎想要的类似于检索和发布文章。
Yes, it can be done with a single TCP connection. For one obvious example, (though a bit more elaborate than you really need) you could take a look at the NNTP protocol (RFC 3977). What you seem to want would be similar to retrieving and posting articles.