in reply to Socket Traffic Cop
is it feasible to have a perl socket listener on one single tcp port that then redirects the socket feed after examining the ip address to another listener on the same box ?
It doesn't make much sense to do that at the level of a Perl script. Once the remote client connects, it won't, in the absence of some pre-existing protocol, reconnect to another listener. All you could do is have your server connect to the other local listeners and then act as go-between (proxy), forwarding each inbound packet and getting any responses and sending them back to the remote system.
It won't make any future connects (seperate or concurrent) from that remote system go directly to the other local listener. They'll still come through the original listener. Each having to connect to a new instance of the other local listener and relay through. You'd just be creating lots of middleman processes that do nothing but create a bottleneck.
Once a remote client connects to your listener, all you need is to hand off the accepted socket to the right piece of code--be that a process or thread--dependent upon the remote IP of the inbound connection. And that's very easy, far less costly, and far less fragile.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Socket Traffic Cop
by sans-clue (Beadle) on Apr 13, 2010 at 02:13 UTC | |
by BrowserUk (Patriarch) on Apr 13, 2010 at 03:10 UTC | |
by sans-clue (Beadle) on Apr 13, 2010 at 04:02 UTC | |
by BrowserUk (Patriarch) on Apr 13, 2010 at 04:51 UTC |