PDA

View Full Version : Time taken in getting IP addresses



nikhilqt
13th April 2011, 15:51
Hi All,

I have a priority in loading my application as fast as possible. So one of the steps which takes tangible time in seconds(rest are in ms) is getting the IP address. So here is the concern in time taken by a static method of QNetworkInterface for getting all the addresses.


sActualIPAdd = QNetworkInterface::allAddresses().first().toString ();

is taking 6 seconds in wireless network and 2 seconds in wired network. Is this can be reduced ?

Thanks,
Nikhil

kosasker
22nd April 2011, 13:42
I have same problem.

tbscope
22nd April 2011, 15:17
Does the IP change regularly? Or is it a fixed IP?

Just store it in a file. It probably already is stored somewhere by the system itself.
Then it is just reading it from that file.

If it changes regularly, do the same (store the IP in a file) but run a process or thread in the background that regularly scans for a new IP.

kosasker
23rd April 2011, 10:52
Thanks for reply. Its about QNetworkInterface. But if working machine have only 1 network interface (no wireless or bluetooth, just simply ethernet) there is no speed problem.

kosasker
25th April 2011, 08:22
I disabled the look up host section in code and now its working clearly.