1

So I'm writing this program that uses python and sockets to talk over the internet, but that's not the issue.

The issue is I wish to test how the program works in a realistic internet environment.

ie: My client connects to a proxy somewhere over seas, then the data comes back to my router to my other computer.

so I want my data to go overseas, then come back.

Anyway this can be done? or is this impossible? I've tried using proxy servers and I can't for the life of me get them to work!

D. Brumby
  • 33
  • 1
  • 10
  • What is your motivation for doing this? Do you want to test behaviour with high latency? – mensi Jun 04 '12 at 11:48
  • Pretty much. I want to be sure that the program handles it all correctly. I've thought I've wrote a workable socket layer in the past but it would seem that has proven unsufficient, and I can't just rely on other people, otherwise development is slowed/non existant. – D. Brumby Jun 04 '12 at 11:49

4 Answers4

3

You should use wanem or the tc in linux

Do not tunnel your traffic in ssh for this purpose. Tunneling TCP in TCP introduces problems beyond latency.

Community
  • 1
  • 1
Mike Pennington
  • 41,899
  • 19
  • 136
  • 174
  • To quote: _"Because the timeout is still less than the lower layer timeout, the upper layer will queue up more retransmissions faster than the lower layer can process them"_ – D. Brumby Jun 04 '12 at 12:16
1

You could set up a simple SSH tunnel on a remote machine:

ssh -N your-oversea-server.com -L 1234:your-other-computer.com:1234

Then, your client could connect to your-oversea-server.com:1234 and the traffic would be redirected to your-other-computer.com:1234.

Stefan
  • 109,145
  • 14
  • 143
  • 218
  • Your answer requires tunneling TCP in TCP traffic. That introduces far more negative dynamics in the simulation than merely high delay. – Mike Pennington Jun 04 '12 at 11:59
0

use a no-ip client on your server (let's say myserver.no-ip.com) bind your server to 0.0.0.0 port 80 and on your home router define your server lan ip as dmz. on the other pc (which could be located in the other room, on the same lan) connect to myserver.no-ip.com. you can chack if it travels overseas with trace route: tracert myserver.no-ip.com. If that doesn't help use a proxy on the client's computer. (most free proxies allows only port 80 traffic)

zenpoy
  • 19,490
  • 9
  • 60
  • 87
  • Good idea actually... I've been running the program on something not 80, but using a web port redirect, i can get it to go out and back that way. I'll give it a try and let you know how it goes. – D. Brumby Jun 04 '12 at 12:18
  • No dice. Gets back to the router then goes to its log in page. :/ – D. Brumby Jun 04 '12 at 12:27
  • @DwayneBrumby actually you should disable the outbound access to your router unless you need some hackers/support guys to connect to it over the Internet – zenpoy Jun 04 '12 at 12:31
  • Hmm. Those settings are off, which means it's not getting past the router in the first place. :/ – D. Brumby Jun 04 '12 at 12:35
  • @DwayneBrumby you should try ping'ing `myserver.no-ip.com` from the client pc to see what the ip it resolves for it. It should be the outside address of your router. And you can change the web access port of your home router to be 9090 or whatever.. – zenpoy Jun 04 '12 at 13:09
0

It depends on the type of program you are writing, if you just want your program to connect to another instance of this same program at some destination ip. Or are you writing a server application? If so, what client connects to this server? I'm not certain you need to involve a proxy at all, TCP traffic will simply travel over the routers/switches it needs to get where it needs to go.

If you can elaborate on your question, and specify if your writing a server that has a differentiated client, or just a desktop app that is both the client/server, that would be helpful.

Mark At Ramp51
  • 5,343
  • 1
  • 25
  • 30
  • It's a bit of both! It's a proxy server in it's own right. It reads packets between the client and server, and modifies them (the client/server are closed source sadly) – D. Brumby Jun 04 '12 at 12:31
  • Hrm. You'll have to decide what works best for you, personally, I'd launch a Amazon Web Services EC2 instance in the region i want to test. They have regions in europe and asia as well as north america. If you use the cheapest server they offer and you only run it for a day or so, it will be free since new accounts qualify under the free usage tier. Just configure this server to perform the echo function or whatever you need it to do to test the round trip for your program. – Mark At Ramp51 Jun 04 '12 at 13:36
  • If you launch an ec2 isntance and install your proxy, you can then configure a client, and a server in north america, and route the traffic through the proxy in asia or europe and this should satisfy your testing needs. I think. :-) – Mark At Ramp51 Jun 04 '12 at 13:44