David Añez
David Añez

Reputation: 75

Simpler method to redirect outgoing connection to localhost in Windows 10

Ok, so I have a program that talks with a device through Bluetooth and enables it to open a socket connection to an external host. I have a simulator that runs in my computer and I want to redirect the outgoing connection to the simulator running in localhost. Even for Windows, this seems more complicated that I think it should be.

Based in this I tried netsh int ip add addr 1 111.222.333.444/32 st=ac sk=tr

Based on this I tried netsh interface portproxy add v4tov4 listenaddress=111.222.333.444 listenport=15000 connectaddress=127.0.0.1 connectport=2405 protocol=tcp

While the outgoing connection always goes to port 15000, I can control the port where my simulator is listening. It is 2405 merely because the first version of the simulator used that port for some reason.

I tried with both active and forgot about them while I searched for alternatives.

I then found this link with no solution, but the OP said that he solved his problem with PassPort, which finally enabled the device's outgoing communication to reach my simulator.

When I tried to revert the netsh commands, I discovered out that I needed both commands active for PassPort to do its trick.

Isn't there a simpler method to achieve this? My system is Windows 10 21H1

I can't use the hosts file because the connection is made directly to the IP, not to a hostname.

Edit: apologies, I just realized that this might have been better to ask in superuser... can I move it or need to delete/recreate?

Upvotes: 1

Views: 1583

Answers (0)

Related Questions