View Full Version : [SOLVED] QTcpSocket with Java Server VERY slow packet transfer

18th August 2011, 05:36
Hi all.

I'm having a slight issue. I'll send a string through the connection using QTcpSocket::write( const char * ), and it gets to the server ( Which is located on a virtual machine on the same computer as the client ). But when I try to send a message from the Java Server, it takes 30-60 seconds to get the packet on the client side.

On the client (Qt), the readReady signal that's emitted from my QTcpSocket only emits every 30-60 seconds.

I have enabled TCP_NODELAY on both the client and the sever, so I'm more or less at a loss for what's wrong.


Added after 1 16 minutes:

Okay, I figured out what the problem was. The java Stream writer was holding the text until the buffer was filled. I forced the stream to flush on the server side, and the client received the update. However, there is still a very high latency, that seems to get worse over time.


Added after 28 minutes:

Got it!

The problem was that the server was located on my VM. I moved the server to my other computer, and it worked just fine.