Archived

This topic is now archived and is closed to further replies.

foofightr

resolving = blocking?

Recommended Posts

gethostbyname() I don''t see anything in MSDN about this function blocking, but logically it has to, right? It has to go out from your computer, access a DNS server, and come back? I''m just concerned that if someone is runing my game and their connection is down, and they try to connect to a server using a "server.whatever.com" kinda address, it will freeze their program for X seconds?

Share this post


Link to post
Share on other sites
Yeah it blocks and there''s not really anything you can do about it in standard sockets. On Windows you can use WSAAsyncGetHostByName.

Share this post


Link to post
Share on other sites
The alternatives:

- queue a user APC to a separate thread and when the APC is executed, perform the blocking call there.

- queue a work item to the process'' thread pool (under Windows 2000+)

Share this post


Link to post
Share on other sites
The other way is to create your own DNS query procedure...

"I''ll be Bach!" (c) Johann Sebastian Schwarzenegger

Share this post


Link to post
Share on other sites
Thanks for the answers. Since I don''t particularly care for the methods suggested, I''ve decided that you''ll just have to enter direct IP addresses in my game

Share this post


Link to post
Share on other sites