Created
October 28, 2012 20:22
-
-
Save akaptur/3969753 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| To dissect the behavior of this server and client, I need two things: more realistic network latency than is produced by making connections directly to localhost, and some way to see a microsecond-bymicrosecond report on what the client and server are doing. | |
| These two goals may initially seem impossible to reconcile. If I run the client and server on the same machine, the network latency will not be realistic. But if I run them on separate servers, then any timestamps that I print will not necessarily agree because of slight differences between the machines’ clocks. | |
| My solution is to run the client and server on a single machine (my Ubuntu laptop, in case you are curious) but to send the connection through a round-trip to another machine (my Ubuntu desktop) by way of an SSH tunnel. See Chapter 16 and the SSH documentation itself for more information about tunnels. The idea is that SSH will open local port 1061 here on my laptop and start accepting connections from clients. Each connection will then be forwarded across to the SSH server running on my desktop machine, which will connect back using a normal TCP connection to port 1060 here on my laptop, whose IP ends with .5.130. Setting up this tunnel requires one command, which I will leave running in a terminal window while this example progresses: | |
| $ ssh -N -L 1061:192.168.5.130:1060 kenaniah |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you don't have an externally visible ip, you can replace this with
ssh -NL 10000:localhost:10000 tomb@thomasballinger.comand
ssh -NR 10000:localhost:10001 tomb@thomasballinger.com