Skip to main content
gamedev.net
🔒 Locked

resolving = blocking?

Started by foofightr May 7, 2003 at 11:10 AM 3 replies 600+ views
Original Post
foofightr
foofightr
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?
Anon Mike
Anon Mike
Yeah it blocks and there''s not really anything you can do about it in standard sockets. On Windows you can use WSAAsyncGetHostByName.
-Mike
Dire.Wolf
Dire.Wolf
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+)

[email=direwolf@digitalfiends.com]Dire Wolf[/email]
www.digitalfiends.com
x33
x33
The other way is to create your own DNS query procedure...

"I''ll be Bach!" (c) Johann Sebastian Schwarzenegger
"I'll be Bach!" (c) Johann Sebastian Schwarzenegger
foofightr
foofightr
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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.