Jump to content
  • Advertisement

Archived

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

Dr Pain

UDP Broadcast problem

This topic is 5884 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''ve got a server app (game server) that I want to use UDP broadcasting on my LAN to talk to other similar servers (broadcasting just to get the initial IPs of other servers). There are two computers on my LAN running this server, let''s call them A and B. They are connected via a LinkSys cable-modem router. Now, when A broadcasts, B receives the packets fine, but A does not see them. When B broadcasts, A does not see them, but B does. So, in other words, both A and B seem to be transmitting fine, but only B is receiving. They are using the exact same code, and I''ve compared the TCP/IP settings against each other with no discrepancies (other than IP address). I am using 192.168.0.6 and 192.168.0.10 as IP addresses, and 255.255.255.0 as my netmask on both. Any ideas what could be causing this? Thanks, Dave

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Off the top of my head, rather than actually broadcasting you are actually only sending to B''s ip address

Share this post


Link to post
Share on other sites
A logical guess, but I''ve tried all three of the following with the same results:

bcastAddr.sin_addr.s_addr = inet_addr("255.255.255.255");
bcastAddr.sin_addr.s_addr = inet_addr("192.168.0.255");
bcastAddr.sin_addr.s_addr = INADDR_BROADCAST;

But I''ve just discovered more information this morning. It seems that computer A (the one having trouble receiving) actually does receive, but only during the first run of the program after reboot! The second time I run the program, it doesn''t receive. It''s as if during the first run, the program is grabbing some resource that it''s not letting go of for subsequent runs. I am closing the broadcast socket and then call WSACleanup. Is there anything else I need to do to clean up upon exit?

Share this post


Link to post
Share on other sites
Ok, this is ticking me off. I''ve tried it on four different computers, and it works fine on all but the first one, my laptop. I even tried uninstalling and reinstalling the TCP/IP protocol and network drivers with no change.

Is there some registry setting or driver setting which disables broadcast receiving? This is looking more and more like a system problem than a programming error.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!