Click here to Skip to main content
15,890,506 members
Articles / Web Development / HTML
Tip/Trick

Test Multicast IP Network Traffic

Rate me:
Please Sign up or sign in to vote.
3.97/5 (9 votes)
14 Mar 2017CPOL3 min read 19.5K   767   9   5
Test Multicast IP network traffic passing through the firewall between the computers that are in different IP sub-nets

Introduction

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 are not under my control and these jobs are delegated to others, I needed a simple tool with which I could test this kind of network traffic, between the above computers.

I made a search on the site codeproject.com and found an interesting article on this topic: "IP Multicasting in C #" by Gary Brewer published on 10th January, 2002. In the aforementioned article (thanks’ to Gary), the basics of Multicast IP traffic theory have been explained and source code functions written in C# to test multicast IP traffic is supplied. I took the aforementioned code and created a new project using Visual Studio 2015 and added new functionality to the 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 this code, I use external libraries Costura.Fody and CommandLineParser.

Explanation of Used External Libraries

Costura.Fody - (Embeds dependencies as resources) Costura.Fody allows creating executable code (.exe) file with all the necessary files (.dll) imported into executable file. When you deliver executable code, you do not have to deliver referenced external .dll files that were used to compile the program.

CommandLineParser - 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 needs to be started on the computer where we will test acceptance of multicast IP packets that are sent from the network (MulticastReceive.exe) and the other executable program needs 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 238.0.0.1 and port 5050. Possible parameters and values that can be used when starting the program can be got if you start the program with the command line parameter "-h":

C++
// MulticastReceive.exe -h
// MulticastReceive 1.0.0.0
// Copyright c 2017
// 
//   -a, --multicastip (Default: 238.0.0.1) 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 needs to be started 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, the program will send multicast IP traffic to the IP address 238.0.0.1, 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 used when you start the program, you can see if you start the program from the command line with "-h" parameter:

C++
// MulticastSend.exe -h
// MulticastTest 1.0.0.0
// Copyright c 2017
// 
//   -a, --multicastip (Default: 238.0.0.1) 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 need to test three different scenarios:

  1. When both programs start on the same machine, to verify that the programs are functioning properly, 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

You can find the complete source code project on GitHub.

Additional Resources

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Retired Serbia BroadBand
Serbia Serbia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionHave you consider to post this as a tip? Pin
Nelek14-Mar-17 5:34
protectorNelek14-Mar-17 5:34 
AnswerRe: Have you consider to post this as a tip? Pin
Vladan.Obradovic14-Mar-17 8:36
professionalVladan.Obradovic14-Mar-17 8:36 
GeneralRe: Have you consider to post this as a tip? Pin
Nelek14-Mar-17 19:53
protectorNelek14-Mar-17 19:53 
QuestionBad Link Pin
spottedmahn13-Mar-17 10:34
spottedmahn13-Mar-17 10:34 
GeneralMy vote of 4 Pin
Member 102670219-Mar-17 23:01
Member 102670219-Mar-17 23:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.