views:

33

answers:

1

I am creating a program that listens to video streams over multicast. Listening to one feed with Mono on Linux works fine but listening to 15 feeds drops packets. Running the code on Windows .NET does not drop packets and listening to the feeds with a C program on Linux does not drop packets. Is there something I could do to optimize this?

+2  A: 

Depending on what mechanism you use, code wise, you may not be capturing the packets fast enough. That would result in drops of multicast data, which by its very nature is unreliable. Without more info about the mechanism employed, it's difficult to give you any more specific advice.

Update based on comments:

If you have a thread per receiver and more threads than CPUs, you may be oversubscribing your threads, causing a lot of expensive context switching. This could lead to dropped packets.

Michael Goldshteyn
I am creating a UdpClient, using .Client.Bind on the multicast address, then calling BeginReceive. In the callback, I put the received data into a Queue. This happens on its own thread.
Dan Goldstein
You were right about it being an OS resource. Each process is taking up 100% of a core.
Dan Goldstein
Glad to hear that it was something easy to diagnose!
Michael Goldshteyn