Jump to content
  • Advertisement
Sign in to follow this  
ryan009ryan

How to get UDP broadcast packets

This topic is 3165 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

Hi, I am playing warcraft3 in LAN. What i noticed is that my game is sending and receiving UDP packets from 6112 port of my computer. I want to get those packets by code in java or c++. Any idea will be appreciate. Thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
My game is running on my Computer "A" and i want to make a program which will also run on my computer "A". When game will run this will give and receive UDP packets from computer "B" and "C" in same network. My target is that computer "A" (after running game) should understand of my process as a client ( computer "D"). So when game will broadcast than i will also grab packets. But i am not able to connect with same port which are already using by game. What is concept behind it to understand same pc as client where server is hosting. is this virtual network ?

Here "A","B","C" and "D" are dummy name as for mentioning.

Share this post


Link to post
Share on other sites
Use WinPCap. Easiest is to install and use Wireshark -- it can capture files that you can analyze from C++ or Java.

Share this post


Link to post
Share on other sites
Btw: your post title says "broadcast," but your message just says "sending on port 6112."

If it really is UDP broadcast, then all you have to do is turn on SO_BROADCAST on the socket (with setsockopt()) and bind() to port 6112 on all local subnets (IPADDR_ANY), and you will get a copy of those broadcast packets.

Share this post


Link to post
Share on other sites
Thanks for your response. but the problem is that my game is using the 6112 port to send and receive broadcast udp packets and i want those udp packets. cause the game is using 6112 port so i am not able to listen on 6112 port by my program because game and program is running on the same computer . please tell me how to get these packets by program.

Share this post


Link to post
Share on other sites
If you create a socket, turn on SO_BROADCAST, and bind to port 6112, then you will get broadcast packets on that port. You may have to turn on SO_REUSEADDR to be able to bind more than one socket to the same port.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!