cat file to multicast

14,384
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
Share:
14,384

Related videos on Youtube

John Dibling
Author by

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, 2022

Comments

  • John Dibling
    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
      Graeme about 10 years
      nc or socat?
    • Graeme
      Graeme about 10 years
      nc (possibly netcat) should be a standard tool on most systems, is this not the case on redhat?
    • John Dibling
      John Dibling about 10 years
      @Graeme: man nc said no. i'll try netcat
    • John Dibling
      John Dibling about 10 years
      @Graeme: Niether nc nor netcat are part of the RHEL distro, and niether were in the repos. I waws able to get netcat installed from source however.
    • Graeme
      Graeme about 10 years
      Interesting, the simple netcat package is marked as important 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
    Tchakabam about 3 years
    also nice btw, instead of using cat, use head/tail instead with bytes amount specified :)
  • higginse
    higginse over 2 years
    I 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.