Yet another proxy server… how to turn multicast into unicast…

We are using multicast to deliver more than 20 MPEG-2 encoded video+audio streams in our network. The advantages of using multicasting in a network of more than 2000 machines are well known. But there are several scenarios when multicasting is not the right choice.

For example: in wireless environments you have to use some sort of multicast group management which is not always as flexible as a more simple solution. You would end up multicasting all 20 streams into the wireless network – which would just explode or something. (our multicasting traffic volume is around 125 Mbit/s…which is… quite much)

I started writing such a solution two days ago and now I want to make the first lines of code available for everybody to try out.

To speak simple: it’s just another proxy server. It’s a HTTP Server that can be triggered to join a multicast group (hardcoded in this version) and forward the traffic from that multicast group directly to the client that asked for it. It’s as simple as it can get and to be more technical: the proxy receives udp multicast packets and sends them as tcp unicast packets.

When you tell MPlayer to trigger the proxy by asking for /hr.ts you would get something like this (if you have a multicast group on that IP/Port):

As you can see: MPEG2-Transport Stream inside. So it works as designed. There are some glitches I am afraid to say: one known bug is that there are 12 bytes to much in the outgoing data stream which corrupts the picture. If anyone here can fix it: Do it please ;) I tried one day and I could not find a solution for the problem.

Anyways: It’s doing what it’s supposed to do. And that’s why I am making it available for everyone:

Sourcecode: (11,18 KB)

It compiles with Microsoft.NET 1.1/2.0 and Mono. There’s a Visual Studio 2005 solution file inside to help you compile it. (Should work with Visual C# Express Edition). Oh… and I am releasing it under the BSD license which is included with the package.

Feel free to comment and contribute.

5 thoughts on “Yet another proxy server… how to turn multicast into unicast…

  1. #!/usr/bin/perl
    $ip = $ENV{‘QUERY_STRING’};
    if (!($ip =~ /^\d+\.\d+\.\d+\.\d+$/)) { print “Content-type: text/html\n\nForbidden.\n”; die; }
    sub CATCH_PIPE { print “SIIG_pip”; die “Sig_pipe”; };
    $SIG{‘PIPE’} = “CATCH_PIPE”;
    print “Content-type: video/mpv\n\n”;
    system(“dumprtp $ip 10000 2>/dev/null”);

  2. of course ;) Nice script though. We had this running long before I made the C# version.

  3. in our network we have 350 Mbit multicast traffic with over 57 TV sender, and we use udpxy for multicast to unicast

Comments are closed.