Can socket connections be multiplexed?

Charles Okwuagwu picture Charles Okwuagwu · Mar 20, 2009 · Viewed 8.6k times · Source

Is it possible to multiplex sa ocket connection?

I need to establish multiple connections to yahoo messenger and i am looking for a way to do this efficiently without having to hold a socket open for each client connection.

so far i have to use one socket for each client and this does not scale well above 50,000 connections.

oh, my solution is for a TELCO, so i need to at least hit 250,000 to 500,000 connections

i'm planing to bind multiple IP addresses to a single NIC to beat the 65k port restriction per IP address.

Please i would any help, insight i can get.

**most of my other questions on this site have gone un-answered :) **

Thanks

Answer

tvanfosson picture tvanfosson · Mar 20, 2009

While you can listen on a socket for multiple incoming connection requests, when the connection is established, it connects a unique port on the server to a unique port on the client. In order to multiplex a connection, you need to control both ends of the pipe and have a protocol that allows you to switch contexts from one virtual connection to another or use a stateless protocol that doesn't care about the client's identity. In the former case you'd need to implement it in the application layer so that you could reuse existing connections. In the latter case you could get by using a proxy that keeps track of which server response goes to which client. Since you're connecting to Yahoo Messenger, I don't think you'll be able to do this since it requires an authenticated connection and it assumes that each connection corresponds to a single user.