Archived

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

Finding a server's IP

This topic is 5623 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm using winsock with a TCP connection over a LAN, and I need a way for a client machine to find out the server's IP address without it being specified manually. I've looked into multicasting (with UDP), but I can't get it to work on my network. There must be a standard way of doing this, but I can't find info on it. Any suggestions? ____________________________________________________________ www.elf-stone.com [edited by - benjamin bunny on July 25, 2002 10:30:23 AM]

Share this post


Link to post
Share on other sites
Using TCP/IP, you could use the broadcast address to look for servers. The broadcast address is either 0 or 255 generally. (192.168.1.255 to broadcast to 192.168.1.x)

People used to use IPX for broadcast traffic as well (That''s how you played DOOM I on a Lan). It would work well in this case, if you think you can get your users to install it. It''s not so commonly present on windows PCs anymore.

Share this post


Link to post
Share on other sites
Yes, broadcasting is the way. The broadcast address is dpendent on the IP address as well as the netmask. But Winsock gives you ways to do it. Just lookup the reference to Winsock on MSDN at the Microsoft site. Try looking up INADDR_BROADCAST and go from there.

You have to set the socket options for sending and recieving of broadcast packets (UDP only). Then send to the INADDR_BROADCAST address. The socket etup to recv briadcast packets will get them. Just reply to the address that send the packet


Stephen Manchester
Senior Technical Lead
Virtual Media Vision, Inc.
stephen@virtualmediavision.com
(310) 930-7349

Share this post


Link to post
Share on other sites