views:

272

answers:

2

I have an application that I develop in Silverlight and it must connect to another legacy app that I cannot control which demands TCP connection on the 3005 port.

I can't modify the legacy app to bring the port in the silverlight accepted range (4502 - 453x).

Is there a bridging app / another solution that would listen on a configurable port (say 4502) and forward everything to another port (say 3005) ? And vice-versa.. receive from that socket and push it back to "me"?

What options do I have?

+3  A: 

I believe this is known as port forwarding.

Most routers can do this.

On a Linux box, you can use iptables. On Windows use for instance this.

If I understand the silverlight socket security model correctly, a silverlight application can only connect to the host it was downloaded from, and only to a certain port range (80, 4502-4532 [BTW, does anyone know why that particular port range was selected?]).

So to connect from SL to you legacy app, you would have to...

Either:

  • Have port mapping running on the server that the SL app is served from (probably a web server running IIS, right? That means it's a Windows box so search for 'port mapping windows', PortMapper seems to be popular.)
  • Configure the port mapper to forward port 45xx to port 3002 on the server that the legacy app is running on (maybe the same server as the web server?)

Or:

if all traffic to the web server must pass through a certain router that you have some sort of control over, you could configure the port mapping there.

codeape
thanks, I will go search for this term also :)
Andrei Rinea
I checked out the two port forwarding utilities you linked to but neither one has satisfied me so I wrote one myself and it works :D
Andrei Rinea
+2  A: 

If traffics passes trough a firewall or NAT router, it probably can be configured to do that.

Otherwise you can always write a service that listens to the port you want and forwards it to the 3005 port. But this can cause issues when the server is using the IP addresses of the client in some way.

Some firewall software on the server should be able to do this to.

Glenner003
thank you!
Andrei Rinea