Code Monkey home page Code Monkey logo

winipbroadcast's Introduction

WinIPBroadcast 1.6

Author: Etienne Dechamps (a.k.a e-t172) [email protected]

https://github.com/dechamps/WinIPBroadcast

WinIPBroadcast is a small program that allows Windows applications to send global IP broadcast packets (destination address 255.255.255.255) to all interfaces instead of just the preferred one.

This application is most useful for users of server browsers or other network monitoring software. Specifically, those playing multiplayer games locally on multiple interfaces (for example, a LAN network and a Hamachi VPN) will be able to see games from all networks at once.

WinIPBroadcast is an open source (GPL), extremely small (450 lines, 15KB executable) C program. It works "behind the scenes" as a service without any user interaction. Its memory usage is 1MB. When you're not sending any broadcasts, its CPU usage is strictly zero.

Rationale

Windows 7 only sends global IP broadcast packets (destination address 255.255.255.255) on the interface which matches the preferred route for 255.255.255.255 in the route table.

More often than not, this isn't what you want: software that makes use of global broadcast packets (e.g. server browsers, games) expect these packets to be sent to all interfaces in order to reach all the local hosts your computer has access to.

For example, consider a computer which is simultaneously on a LAN and on a VPN. The user is a video game player who sometimes use multiplayer on the LAN, sometimes on the VPN with a few friends. Unfortunately, the game uses global broadcast packets to discover open games on the local network. Consequently, the player will only be able to see games on one network: the LAN or the VPN, depending on his routing table (most probably the LAN). He can modify his routing table to see games on the VPN, but he won't be able to see both at the same time.

WinIPBroadcast is an extremely small program (15 KB executable) which has been specifically designed to solve this problem. It works using an interesting fact: it is possible to receive locally generated global broadcast packets when listening on the loopback address (127.0.0.1). WinIPBroadcast listens on the local address for all broadcast using RAW sockets, then for each broadcast packet, it relays it to all interfaces except the prefered one.

Thus, if an application send a broadcast packet, Windows will send it to the preferred interface, then WinIPBroadcast will receive it and resend it to all other interfaces. In the end the packet is sent on all network interfaces: problem solved.

WinIPBroadcast has been successfully tested on Windows 7 and Windows 10. Older Windows versions are unsupported.

Caveats & limitations

WinIPBroadcast cannot "see" packets where the source and destination ports are identical. So, for example, if the application is sending packets to 255.255.255.255:42 from 1.2.3.4:42, WinIPBroadcast won't be able to relay them. This appears to be an inherent limitation of the "loopback address hack" described above. For this reason it is unlikely to ever be fixed. (One example of an application that falls into this category is Command & Conquer 3, which sends packets from port 8086 to port 8086.)

Alternatives

In theory, it should be possible to choose which network interface will be used by default by altering the metric of the global broadcast route. In pratice however, that approach seems to be very hit and miss, and some applications will completely ignore such changes.

In some versions of Windows, it is possible to choose which network interface will be used by default by changing the adapter order in the "Advanced Settings" accessible from a menu in the "Network Connections" folder. Unfortunately, that functionality seems to have been removed in Windows 10.

ForceBindIP can be used to force specific applications to bind to a specific network interface, thereby forcing them to send broadcast packets through that interface.

Basic usage

You just need to install it. WinIPBroadcast runs as a service which will be automatically started at the end of the installation. There is no configuration, It Just Works (TM).

To control WinIPBroadcast, use the Service Manager in the Administration Tools folder of the Control Panel.

Command line usage

You can use WinIPBroadcast on the command line using these parameters:

  • WinIPBroadcast install installs the service.
  • WinIPBroadcast remove removes the service.
  • WinIPBroadcast run runs WinIPBroadcast as a console application. Useful for diagnostics (error messages will be shown).

winipbroadcast's People

Contributors

cincuranet avatar dechamps avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

winipbroadcast's Issues

Puzzels:what are the key lines of the code that send to each interface with raw socket?

Dear sir,
I have a requirement that sending a broadcast to all interfaces to scan a Networking camera (according to the protocal, the device will response), I use raw socket to send the broadcast message, it works when there is only one network interface on my computer, but may fail on the one with multiple interfaces. It's also because the windows route the broadcast to 'preffered' interface. I have read your code, but quite not understand how to replay the messge to multiple interfaces. I am not familiar with socket programming in fact, so could you please explain what is the key point to reach the goal sending to each interface in the function void sendBroadcast? Thank you in advance!

Does not work zerotier

Hi, I'm trying WinIPBroadcast with zerotier (www.zerotier.com), and using Unreal/Unity games to test the LAN broadcast to find the games. It doesn't get to relayBroadcast, all filter out before hand.

I supposed they are using the same port to broadcast/receive, I see in the notes, that it wouldn't work in such case, but doesn't majority of LAN broadcast (for games) use the same port?

Just wanna say thanks !

Yeah yeah, I know Issues is not the place to post that, but I'm not used to Github and I may have missed the casual comments section ?

I reaaaally wanted to say thanks for this wrapper, it saved me from a good two hours of headache trying to set up a clean VPN only for games, aka without having to forward all trafic through it. I wanted just the LAN please. And you guessed it, the broadcast was making me crazy. I know you can just enter an IP and boom, it works (and it did work of course), but I really wanted to show this to some friends and go "yeah, see ? It works as good as in a LAN". Especially when some games do not have a way to enter a direct IP (Torchlight II, I'm looking at ya).

Now, if there's a few games that do not detect parties automatically because of the "same port issue", well, not that big a deal, we'll still be able to enter the IP. At the very least the risk percentage of having a game that do not work has significantly dropped. :)

During my final tests, UT2004 detected my LAN-server twice : once for the real LAN IP, and the other for the VPN IP. Which was my fucking dream come true. Thank you !

Please Make this for Visual Basic 6

Sir can you make this for visual basic 6 source please.
if you cant atleast kindly tell me what is the packet data you send.
do you send anything or just random data? or ip.
please make me vb6 source code

Broadcast happens twice

Hi, WinIPBroadcast partially solved my problem on Windows 7.
I'm using GX Wokrs2 (PLC programming IDE from Mitsubishi) to find available PLCs in the network.
Unfortunatly broadcast happens twice, and the IDE sees the same PLC (same IP address) twice, thus creating IP duplication error.

 Wireshark log
 -------------
 No  Time               Source          Destination      Protocol  Length  Info
 ======================================================================================
 11	5.093238	192.168.56.1	255.255.255.255	 UDP	   84	   51298 > 5559 Len=52  <- used broadcast interface
 12	5.093546	10.0.0.144	255.255.255.255	 UDP	   84	   51298 > 5559 Len=52
 13	5.093652	10.0.0.144	255.255.255.255	 UDP	   84	   51298 > 5559 Len=52
 14	5.094067	192.168.149.1	255.255.255.255	 UDP	   84	   51298 > 5559 Len=52
 15	5.094217	192.168.149.1	255.255.255.255	 UDP	   84	   51298 > 5559 Len=52
 16	5.094335	192.168.116.1	255.255.255.255	 UDP	   84	   51298 > 5559 Len=52
 17	5.094559	192.168.116.1	255.255.255.255	 UDP	   84	   51298 > 5559 Len=52
 
 
 Routing table on my machine
 ---------------------------
 Interface List
  11...44 37 e6 c4 0f 08 ......Intel(R) 82579LM Gigabit Network Connection
  13...0a 00 27 00 00 0d ......VirtualBox Host-Only Ethernet Adapter
  19...00 50 56 c0 00 01 ......VMware Virtual Ethernet Adapter for VMnet1
  20...00 50 56 c0 00 08 ......VMware Virtual Ethernet Adapter for VMnet8
   1...........................Software Loopback Interface 1
  21...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter
  17...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2
  14...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #3
  18...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #4
 ===========================================================================
 
 IPv4 Route Table
 ===========================================================================
 Active Routes:
 Network Destination        Netmask          Gateway       Interface  Metric
           0.0.0.0          0.0.0.0         10.0.0.1       10.0.0.144     20
          10.0.0.0        255.0.0.0         On-link        10.0.0.144    276
        10.0.0.144  255.255.255.255         On-link        10.0.0.144    276
    10.255.255.255  255.255.255.255         On-link        10.0.0.144    276
         127.0.0.0        255.0.0.0         On-link         127.0.0.1    306
         127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
   127.255.255.255  255.255.255.255         On-link         127.0.0.1    306
      192.168.56.0    255.255.255.0         On-link      192.168.56.1    266
      192.168.56.1  255.255.255.255         On-link      192.168.56.1    266
    192.168.56.255  255.255.255.255         On-link      192.168.56.1    266
     192.168.116.0    255.255.255.0         On-link     192.168.116.1    276
     192.168.116.1  255.255.255.255         On-link     192.168.116.1    276
   192.168.116.255  255.255.255.255         On-link     192.168.116.1    276
     192.168.149.0    255.255.255.0         On-link     192.168.149.1    276
     192.168.149.1  255.255.255.255         On-link     192.168.149.1    276
   192.168.149.255  255.255.255.255         On-link     192.168.149.1    276
         224.0.0.0        240.0.0.0         On-link         127.0.0.1    306
         224.0.0.0        240.0.0.0         On-link        10.0.0.144    276
         224.0.0.0        240.0.0.0         On-link      192.168.56.1    266
         224.0.0.0        240.0.0.0         On-link     192.168.149.1    276
         224.0.0.0        240.0.0.0         On-link     192.168.116.1    276
   255.255.255.255  255.255.255.255         On-link         127.0.0.1    306
   255.255.255.255  255.255.255.255         On-link        10.0.0.144    276
   255.255.255.255  255.255.255.255         On-link      192.168.56.1    266  <- used broadcast interface
   255.255.255.255  255.255.255.255         On-link     192.168.149.1    276
   255.255.255.255  255.255.255.255         On-link     192.168.116.1    276
 =======================================================================

====

error 0xc000007b

To start with, it was missing dlls:
api-ms-win-core-synch-l1-2-0.dll,
api-ms-win-core-rtlsupport-l1-2-0.dll,
api-ms-win-core-memory-l1-1-2.dll.
I downloaded them.
After that, i got error (0xc000007b): The application was unable to start correctly.
Any fix for it ?
Windows 7

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.