Important: Please read the Qt Code of Conduct -

Low Speed QTCPSocket on Win7

  • I've created a threaded server application using QTCPServer. It response great and quick on Linux but very slow on Win7. I disabled my network device driver but still same result.
    Where's the problem or any config?

  • No idea without seeing some more information and preferably a small compilable example that reproduces the problem.

  • even i tested the simplest tcp application. it`s slow too.

  • How did you test it? How do you define slow? High latency? Low bandwidth? Long connection setup/tear-down? Under what conditions? Where was the remote end? Did you rely on DNS and is your DNS server responsive? Any firewalls, proxying, or filtering going on?

  • I disabled all controllers such as firewalls, network monitors, antivirus. I tried my app on virtual machine that runs WinXP. VM uses same network settings on host OS. It's ok there. this means that there's no problem in device driver, connection or dns or dhcp settings or anything. right?
    It's very slow on establishing connection from client to server only on Win7.

  • Finally i fixed the problem.
    The problem is where i use both applications (Client and Server) on single pc. So i have to set local IP Address ("") instead of "localhost" on QTCPSocket HostName property. using "localhost" takes time to find the local IP address.

    Thanks Zap.

  • Ah. Glad you got it sorted. Now I wonder why Win7 takes so long to resolve "localhost"?

  • when using "localhost" windows sends a DNS request to domain suffix search list to discover proxy servers via Auto Discovery Protocol. So it takes a time to get response. but is defined as local IP address and it doesn't need to lookup.

  • Ah OK. Does Win7 not have localhost mapped to in etc/hosts anymore then? DNS admins could have fun pointing localhost at something else then ;-)

  • it does, but seems a fake!

  • Very strange. I'm sure MS have their reasons even if they are not clear to the rest of us mere mortals :-) At least you resolved your particular issue.

  • what's the bit of your OS? 32 or 64 bit? one of my friends is having the same problem. His OS is Win7 32-bit OS.

  • [quote author="Mohsen" date="1320060819"]when using "localhost" windows sends a DNS request to domain suffix search list to discover proxy servers via Auto Discovery Protocol. [/quote]

    This problem seems to be related on how Microsoft handles IPv4 and IPv6, If I get it right, this strange behavior is implemented in order to ensure that if you disable IPv4 and do a DNS query for another IPv4 address you don't get such query going thru the loopback interface (that is tied to an IPv4 address:
    Beside this, I consider doing a DNS lookup for localhost a stupid thing, and a sure way for an attack to come. Any other comments could sound a little rude...

Log in to reply