I want to test my Client/Server game for which, currently, I am using localhost for both Client and Server.

Obviously I'm not getting any fluctuation in data and measure idea of performance, and in other parameters, what I wanted to ask how I would test a real world scenario:

if i create a little network with two computers or

if check that on LAN on which i am or

Are these cases (localhost included) equivalent?

or do I really need to test my game on different LANs to have reliable and realistic testing data?

How these different network setups influence the testing process?

Can somebody please suggest methods for testing the effect of network latency and packet loss on my game?

which above setup will give me more up and downs in number with LEAST setup/implementing efforts.

The game is supposed to be played on a LAN but it IS capable of more.


3 Answers 3


Its hard to tell exactly what you're asking, but there's my thoughts.

When testing networking code, its perfectly acceptable to use localhost for both client and server to get it working, because its quick to debug and you can easily debug both client and server. It is important to note, that this is NOT sufficient for testing and final development.

In order for your testing to have maximum impact, you must test as many situations as you can. The minimum you can get away with are (IMO) these:

  1. One client and server on same computer
  2. One client and server on the same SUBNET
  3. One client and server on the same SUBNET with additional players from other SUBNETS (Internet, etc) connecting to server via NAT
  4. Server on the Internet and multiple additional Internet clients connected
  • \$\begingroup\$ thanks, i would appreciate discussion on one of the above scenarios as i have time constraints; testing on multiple/other setups would be difficult, the reason to ask question is to taking help selecting one, so i create that one setup , and then test on that. BY SUBNET you mean LAN? your case 2 > will this be d/f from localhost and will your 2 will be different from my 2 two computer network? \$\endgroup\$ Commented May 30, 2011 at 22:02
  • \$\begingroup\$ If I could only chose a single scenario to test, it would be #4. Because it will cover the most bases. You will need at least two computers to test this in an accurate to the real world way. \$\endgroup\$
    – Nate
    Commented May 30, 2011 at 22:21
  • \$\begingroup\$ actually the 4 is blur to me FYI the game is for LAN means not online/not http based."You will need at least two computers to test this in an accurate to the real world way" yes definitely,you didn't answer my all question, how will you take this if two computer are like this and server, for me it's on same LAN.. DO you have same meanings for subnet, what about if my server is on then it will be on d/f LANs. \$\endgroup\$ Commented May 30, 2011 at 22:31
  • \$\begingroup\$ Those IPs are routable, so in my mind, that is the Internet. What I mean. The information that you get from test #4 is that you know your application will work when its being routed. This is typically the weak link in networking code because it introduces more packet loss and latency. \$\endgroup\$
    – Nate
    Commented May 30, 2011 at 22:41
  • \$\begingroup\$ what i got you mean this kind of test is enough:client and server, (because for me it's on same LAN..) no need to go for using other LAN i.e Server is on e.g \$\endgroup\$ Commented May 30, 2011 at 22:55

You can download software emulators that will artifically add packet loss, network latency, and whatever else you might like into the connection. On reflection, I actually don't know where to get these packages, but I know that they do exist.


Local Host:
All the network testing I've done on localhost has been completely misleading. Since it's a perfect environment it's useless...

Packet Loss:
The packet loss and latency you experience will differ based on your current lan set up. I've set up on several separate routers, and gotten completely different results.

It would be horrifically slow to compile, throw the executable elsewhere, recompile (in the beginning, before menus and such) run it on your compie, and connect, then test. What I've done lately is have a persistant server (on another computer) that simply forwards whatever is sent over any port to a partner, and set my program up as a client, so there's no further config necessary. It's a path that's treated me well so far.

  • \$\begingroup\$ "All the network testing I've done on localhost has been completely misleading. Since it's a perfect environment it's useless... "agreed that's why i am doing this =), im confused by these networking terminologies different subnets, LANs and now routers, no time to revised them \$\endgroup\$ Commented May 30, 2011 at 22:59
  • 1
    \$\begingroup\$ When you use the 'localhost' loopback the data you send doesn't go throught the entire Network Card, it stops at the Network layer and hence all the extra time needed for the Data Link and Physical Layers, and then the time needed to go through cables, etc. is obviously not represented. If you really want to put you program through it's paces, find a helpful soul that lives on the other side of the world, and see how your Client/Server fares. \$\endgroup\$ Commented May 31, 2011 at 7:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .