开发者

How to implement a bidirectional "mailbox service" over tcp?

开发者 https://www.devze.com 2022-12-25 04:09 出处:网络
The idea is to allow to peer processes to exchange messages (packets) over tcp as much asynchronously as possible.

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 m开发者_Python百科echanism using a single TCP connection?

How would that be implemented using BSD sockets and modern OO Socket APIs (like Java or C# socket API)?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号