PDA

View Full Version : IP Caching



Ali Reza
21st November 2012, 08:48
hi all

is there any way to ip caching in Qt ??

regards

anda_skoa
21st November 2012, 18:57
Sure.
Just do the host address lookup manually using QHostInfo and save the host name -> host address mapping in a QHash or QMap.
Then check this container for cached lookups before creating sockets or URLs

Cheers,
_

wysota
22nd November 2012, 03:39
... just bear in mind such caching might get you nowhere because the same name might resolve to different IPs every time you resolve the address. As far as I can see Qt has no facilities to determine when to expire the cache (it does allow to resolve one name to more than one IP though so at least there you should be safe).

Ali Reza
22nd November 2012, 19:56
thanks Mr wysota for your replying.