cat file to multicast
netcat -c -w 1 -v -u -s 127.0.0.1 239.255.0.1 30001 < test.txt
mdump
was used in another session to confirm that the data was being sent:
mdump 239.255.0.1 30001 127.0.0.1
Neither netcat
(nc
) nor socat
was installed on my RHEL6.2 system, and neither was available from the repos. So I installed netcat
from source.
./configure
make
sudo make install
man netcat
Related videos on Youtube
John Dibling
Here's a little joke that cracks me up: So, a guy walks up to me and says, "I'm a tepee. I'm a wigwam. I'm a tepee! I'm a wigwam!" I said to him, "Relax, man. You're two tents!"
Updated on September 18, 2022Comments
-
John Dibling over 1 year
I have a text file (
test.txt
) which represents captured network data. The actual protocol is text-based, with NULL line endings, so this isn't a problem.I need to run this test captured data through my server, over a multicast port. The TTL can be zero -- I'll run both side of this on the same box.
Is there a way to essentially
cat
a file to a multicast port?I already have tools that I use to do this with pcap files and other formats, but I'd prefer to use something quick and builtin rather than crack open that code to make it read text files.
This will be run on an RHEL6.2 server. Command-line, ssh session.
-
Graeme about 10 years
nc
orsocat
? -
Graeme about 10 years
nc
(possiblynetcat
) should be a standard tool on most systems, is this not the case on redhat? -
John Dibling about 10 years@Graeme:
man nc
said no. i'll trynetcat
-
John Dibling about 10 years@Graeme: Niether
nc
nornetcat
are part of the RHEL distro, and niether were in the repos. I waws able to getnetcat
installed from source however. -
Graeme about 10 yearsInteresting, the simple
netcat
package is marked asimportant
for Debian. Seemingly there is also netcat-openbsd, which has more features than the default Debian one (which doesn't appear to be GNU either). Did you have any luck getting either to work with a multicast? Unfortunately I don't know enough about this to offer any answer other than to say these are the common tools for doing a 'cat' over a network.
-
-
Tchakabam about 3 yearsalso nice btw, instead of using
cat
, use head/tail instead with bytes amount specified :) -
higginse over 2 yearsI use this mechanism quite a bit. Great for quick testing. The downside for multicast is that the ttl (which defaults to 1 for multicast) can't easily be set, which is a bit limiting.