开发者

What is multiplex socket communication?

I searched the "multiplex socket" on internet, but couldn’t found开发者_StackOverflow out the difference between multiplex socket and normal socket behaviors.

Normal socket also can communicate on both directions (read and write stream).

I think I must understand wrong about concept of multiplex, welcome your opinion about multiplex communication, Thanks!

EDIT: I use Java to implement the multiplex socket.


AFAIK, Multiplex communication is the sharing of a small number of sockets (e.g. one) to pass data for multiple higher level streams e.g. topics or queues.


Multiplexing is running multiple connections over one socket, all messages for those connections will be received on that socket (or send). So it's not two-way communication, but multiple different communication channels that are handled by one socket.


Where did you find the reference to multiplex socket? I can think of two answers:

First, using a single UDP socket() and recvfrom(2) to receive packets from multiple clients. (One possibility would be the BIND DNS server in recursive mode; older versions used a single socket, rather than connect(2)ing a new socket for every client.)

Second, using a single connection to multiplex several channels into one stream; this is done by e.g. ssh(1) when you ask it for -X X11 forwarding or -L or -R port-forwarding. You can send data bound for the terminal, or an X server, or remote ports, all over a single TCP session.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜