Sign in to follow this  

TCP/IP latency over wifi

Recommended Posts

I wrote my own multi-player server. Everything is functioning fine.

It's amazing to get to play my game against others..

However, I have a serious latency issue.


The biggest problem so far:

I am using TCP/IP over WIFI.

The clients are Android-Java, and the server is JAVA-Windows.

I do not think I want to resort to using UDP, as I am doing Lock-Step so I need a reliable & ordered stream.

My bandwidth requirements are trivial ( < 1kbps )


I have noticed that latency is a bit high (hundreds of milliseconds over WiFi LAN). As I am new to this I am wondering, is there anything I can do to reduce TCP latency?


Right now I am calling flush() after every write() to the outputstream. It is not good enough.


My implementation is very naive (this is my first time), so I am probably overlooking some very simple solutions here.


Any suggestions?

Edited by SillyCow

Share this post

Link to post
Share on other sites

Have you compared the latency over wifi to latency over ethernet, or the latency over a virtual network in your VM test-environment?


As far as I know, you should not see >10ms RTT (round-trip-time) latency over a wifi LAN. If you do, something is wrong, e.g. congestion, or some other operational problem.


Wifi does do implicit retransmissions and other algorithms, however, because of the relatively high speed (normally at least 10mbit/s), it should still not normally delay any packet > 10ms.


The latency caused by a wifi network is usually very small compared to even fairly fast nearby (same continent) links, which could be 50ms RTT even for "good" connections.

Edited by markr

Share this post

Link to post
Share on other sites

I'm surprised you don't see more slowdowns. My experience is that in the outer wifi ranges, latency can shoot through the roof due to the occasional dropped packet. Consider if an occasional 2s latency would be a problem or not.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this