Hello,
Not strictly a CentOS question, but I hope someone can hint me in the right direction ...
I have an incoming udp data stream to public interface that I want to duplicate and multipy to three or more destinations on the internal interface.
Currently I've managed to put together netcat listener with output to pipe and socat reading from that pipe to a single destination. I hoped I could have more than one socat reader from the pipe, but that does not seem to be the case. So I'm able to only redirect stream to a single destination on lan.
I'd also like to avoid this mess of shell tools and pipes and am looking for a cleaner solution.
Any hints?
Jure Pečar wrote:
I have an incoming udp data stream to public interface that I want to duplicate and multipy to three or more destinations on the internal interface.
Currently I've managed to put together netcat listener with output to pipe and socat reading from that pipe to a single destination. I hoped I could have more than one socat reader from the pipe, but that does not seem to be the case. So I'm able to only redirect stream to a single destination on lan.
I'd also like to avoid this mess of shell tools and pipes and am looking for a cleaner solution.
Any hints?
if you control the app on the destinations, you could use multicast? Otherwise maybe broadcast on your LAN, all interested clients can pick up the packets.
On Wed, 17 Feb 2010 12:36:33 +0100 Nicolas Thierry-Mieg Nicolas.Thierry-Mieg@imag.fr wrote:
if you control the app on the destinations, you could use multicast? Otherwise maybe broadcast on your LAN, all interested clients can pick up the packets.
Yes, these are the options, but what if I'm limited to unicasts? How do I take one packet, clone it into three, change destination address and send them out?
Jure Pečar wrote:
On Wed, 17 Feb 2010 12:36:33 +0100 Nicolas Thierry-Mieg Nicolas.Thierry-Mieg@imag.fr wrote:
if you control the app on the destinations, you could use multicast? Otherwise maybe broadcast on your LAN, all interested clients can pick up the packets.
Yes, these are the options, but what if I'm limited to unicasts? How do I take one packet, clone it into three, change destination address and send them out?
I don't think there is a generic tool for that, but it would be fairly simple to write a C program to do exactly what you want. If it is something like a video or audio stream you might get vlc (videolan client) to receive and convert to multicast.
On Wed, 17 Feb 2010 07:35:46 -0600 Les Mikesell lesmikesell@gmail.com wrote:
I don't think there is a generic tool for that, but it would be fairly simple to write a C program to do exactly what you want. If it is something like a video or audio stream you might get vlc (videolan client) to receive and convert to multicast.
Ok, seems like the right time to dust off my C skillz and learn some socket & network programming :)
On 2/17/2010 8:55 AM, Jure Pečar wrote:
On Wed, 17 Feb 2010 07:35:46 -0600 Les Mikeselllesmikesell@gmail.com wrote:
I don't think there is a generic tool for that, but it would be fairly simple to write a C program to do exactly what you want. If it is something like a video or audio stream you might get vlc (videolan client) to receive and convert to multicast.
Ok, seems like the right time to dust off my C skillz and learn some socket& network programming :)
I'd cheat and start with the netcat source. Since it's udp you don't have to wait for the receiver - just open multiple output sockets and write to them like it already does with one.
Jure Pečar wrote:
On Wed, 17 Feb 2010 07:35:46 -0600 Les Mikesell lesmikesell@gmail.com wrote:
I don't think there is a generic tool for that, but it would be fairly simple to write a C program to do exactly what you want. If it is something like a video or audio stream you might get vlc (videolan client) to receive and convert to multicast.
Ok, seems like the right time to dust off my C skillz and learn some socket & network programming :)
probably be pretty easy in perl or python...
perhaps start with this, http://perldoc.perl.org/perlipc.html#UDP%3a-Message-Passing and turn it around so its listening for one UDP socket coming in, and sending it to however many destinations you need.
Les Mikesell wrote:
Jure Pečar wrote:
On Wed, 17 Feb 2010 12:36:33 +0100 Nicolas Thierry-Mieg Nicolas.Thierry-Mieg@imag.fr wrote:
if you control the app on the destinations, you could use multicast? Otherwise maybe broadcast on your LAN, all interested clients can pick up the packets.
Yes, these are the options, but what if I'm limited to unicasts? How do I take one packet, clone it into three, change destination address and send them out?
I don't think there is a generic tool for that, but it would be fairly simple to write a C program to do exactly what you want. If it is something like a video or audio stream you might get vlc (videolan client) to receive and convert to multicast.
If speed wasn't an issue couldn't you use socat, tee, pipes and fifo's and socat again to rebroadcast it ? i.e socat as the listener redirect to a fifo, have cat or socat as a listener to rebroadcast , use tee to send to another fifo and another socat instance to send to another host. Horrible I know but feasible.
Philip Manuel wrote:
if you control the app on the destinations, you could use multicast? Otherwise maybe broadcast on your LAN, all interested clients can pick up the packets.
Yes, these are the options, but what if I'm limited to unicasts? How do I take one packet, clone it into three, change destination address and send them out?
I don't think there is a generic tool for that, but it would be fairly simple to write a C program to do exactly what you want. If it is something like a video or audio stream you might get vlc (videolan client) to receive and convert to multicast.
If speed wasn't an issue couldn't you use socat, tee, pipes and fifo's and socat again to rebroadcast it ? i.e socat as the listener redirect to a fifo, have cat or socat as a listener to rebroadcast , use tee to send to another fifo and another socat instance to send to another host. Horrible I know but feasible.
Maybe - but but I'd expect tee to run buffered and you probably need to preserve the packet boundaries instead of just sending the stream. It might work to tell netcat to forward to a multicast group address if the end points can listen appropriately.
Jure Pečar sent a missive on 2010-02-17:
Hello,
Not strictly a CentOS question, but I hope someone can hint me in the right direction ...
I have an incoming udp data stream to public interface that I want to duplicate and multipy to three or more destinations on the internal interface.
Currently I've managed to put together netcat listener with output to pipe and socat reading from that pipe to a single destination. I hoped I could have more than one socat reader from the pipe, but that does not seem to be the case. So I'm able to only redirect stream to a single destination on lan.
I'd also like to avoid this mess of shell tools and pipes and am looking for a cleaner solution.
Any hints?
Perhaps retransmitting to a multicast address?