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: YAPS.zip (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.