Note that there are some explanatory texts on larger screens.

plurals
  1. POMy ISP is forcing me to buffer tcp data before sending it
    text
    copied!<p>I have a Java TCP game server, I use <code>java.net.ServerSocket</code> and everything runs just fine, but recently my ISP did a some kind of an upgrade, where, if you send two packets very fast for the same TCP connexion, they close it by force.</p> <p>This is why a lot of my players are disconnected randomly when there's a lot of traffic in game (when there is a lot of chance that the server will send 2 packets at same time for the same person)</p> <p>Here is an example of what I mean: If I do something like this, my ISP will close the connexion for no reason to both client and server side:</p> <pre><code>tcpOut.print("Hello."); tcpOut.flush(); tcpOut.print("How are you?"); tcpOut.flush(); </code></pre> <p>But it will work just fine if i do something like this:</p> <pre><code>tcpOut.print("Hello."); tcpOut.flush(); Thread.sleep(200); tcpOut.print("How are you?"); tcpOut.flush(); </code></pre> <p>Or this:</p> <pre><code>tcpOut.print("Hello."); tcpOut.print("How are you?"); tcpOut.flush(); </code></pre> <p>This only started a couple of weeks ago when they (the ISP) did some changes to the service and the network. I noticed using Wireshark that you have to have at least ~150ms time between two packets for same TCP connexion or else it will close.</p> <p>1)Do you guys know what is this called ? does is it even have a name ? Is it legal ?</p> <p>Now I have to re-write my game server knowing that I use a method called: <code>send(PrintWriter out, String packetData);</code></p> <p>2)Is there any easy solution to ask java to buffer the data before it sends it to clients ? Or wait 150ms before each sending without having to rewrite the whole thing ? I did some googling but I can't find anything that deals with this problem. Any tips or information to help about this would be really appreciated, btw speed optimisation is very crucial. Thank you.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload