I recently had the need to test Multicast IP network traffic passing through the firewall between the computers that are in different IP subnets. Because administration and configuration of the firewall devices not under my control and these jobs are delegated to others, I needed a simple tool with which I can test this kind of network traffic, between the above computers.
I made a search on the site codeproject.com and found interesting article on this topic: "IP Multicasting in C #" (https://www.codeproject.com/Articles/1705/IP-Multicasting-in-C) author: Gary Brewer from the 10 Jan 2002. In the aforementioned article (thanks’ to Gary) is explained basics Multicast IP traffic theory and is supplied with source code functions written in C# to test multicast IP traffic. I took the aforementioned code and created new project using Visual Studio 2015 and add new functionality to mentioned code, which I needed for testing. The project was designed for .NET 4.6 version and tested on computers with operating systems w2k12R2, windows7, w2k16 and windows 10. In the this code I use external libraries Costura.Fody and CommandLineParser.
Explanation of used External Libraries
Costura.Fody – (Embeds dependencies as resources.) https://github.com/Fody/Costura Costura.Fody allows creating executable code (.exe) file with all the necessary files (.dll) imported into executable file. When you the delivery executable code, you does not have to deliver a referenced external .dll files that were used to compile the program.
CommandLineParser – https://github.com/gsscoder/commandline/tree/stable-184.108.40.206 Library CommandLineParser was used to validate and parse the parameters that are submitted to programs from the command line.
How to use
The program consists of two executable (.exe) programs. One executable program need to be started on computer where we will test acceptance of multicast IP packets that are sent from the network (MulticastReceive.exe) and the other executable program need to be started to generate multicast IP traffic (MulticastSend.exe).
If MulticastReceive.exe starts without any parameters, the program by default listens for incoming multicast traffic on the IP address 220.127.116.11 and port 5050. Possible parameters and values that can be use when starting the program, can be get if you start the program with the command line parameter "-h":
// MulticastReceive.exe -h // MulticastReceive 18.104.22.168 // Copyright c 2017 // // -a, --multicastip (Default: 22.214.171.124) multicast IP address to send data // // -p, --port (Default: 5050) Port to send data // // --help Display this help screen.
If, for example, you want to start listening for incoming multicast traffic on a multicast IP address 224.0.1 and port 5000, it is necessary to start the program as follows: MulticastReceive.exe 224.0.01 -a -p 5000.
Another program required for testing, need to be start on the computer that will generate and send the network multicast traffic (MulticastSend.exe). If you start the program without any command line parameters, by default program will send multicast IP traffic to the IP address 126.96.36.199, port 5050, with default value of 3 for the limitation of the jump (TTL – eng. Time To Live or Hop Limit), 5 data packets with a length of 30 characters per package. Possible parameters and values that can be use when you start the program, you can see if you start program from command line with "-h" parameter:
// MulticastSend.exe -h // MulticastTest 188.8.131.52 // Copyright c 2017 // // -a, --multicastip (Default: 184.108.40.206) multicast IP address to send // data // // -p, --port (Default: 5050) Port to send data // // -t, --ttl (Default: 3) The Time To Live (TTL - Hop Limit) // // -n, --numberofpacket (Default: 5) Number of packet sent to // // -s, --size (Default: 30) UDP packet size in bytes (1 byte = 1 // character) // // --help Display this help screen.
If, for example, you want to start sending the multicast IP traffic to IP address 224.0.1, port 5000, with TTL 5, 10 packages with packet size of 1KB (1024 characters), it is necessary to start the program as follows: MulticastReceive.exe 224.0.01 -a -p 5000 -t 10 -s 5 -n 1024.
How to start multicast IP test
When testing the functionality of the program due to the presence of firewall devices, you necessary to test three different scenarios:
1. When both programs start on the same machine, to verify that the programs properly functioning, to generate and accept the generated multicast ip traffic
2. when the programs start on different computers that are located in the same IP subnet, i.e. when not in use default gateway for sending IP traffic between computers
3. When the programs start on different computers that are located in different IP subnets, i.e. when using the default gateway for sending IP traffic between computers
Source code project
Complete source code project you can find on GitHub https://github.com/vladano/MulticastTest/
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)