Thread: Simple UDP Transfer Utility

  1. #1
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273

    Simple UDP Transfer Utility

    Hello,

    I could do this myself, but to save myself a day or so, is anyone aware of a utility that can be used to send/recv binary data to a specific address : port via UDP?

    It would be sort of like an interactive version of Wireshark.

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    It shouldn't take you that long; all you need is something that takes an address and port on the command line, then reads from stdin so you can pipe data into it. In C, that's <50 lines, and it looks like Boost::asio will simplify that in C++:

    TCP, UDP and ICMP - Boost 1.38.0

    Or if you have perl:

    Code:
    #!/usr/bin/perl
    use strict;
    use warnings FATAL => ('all');
    
    use IO::Socket::INET;
    
    my $sock = IO::Socket::INET->new (
    	PeerAddr => $ARGV[0],
    	PeerPort => $ARGV[1],
    	Proto => 'udp'
    );
    
    $sock->send($_, 0) while (<STDIN>);
    Usage, eg:

    ./udpsend.pl localhost 1313 < somedata.bin
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help On Simple .dat Utility
    By Led4urhead123 in forum C++ Programming
    Replies: 1
    Last Post: 07-08-2008, 03:22 PM
  2. Implementing a simple transfer protocol
    By _izua_ in forum Networking/Device Communication
    Replies: 6
    Last Post: 09-04-2007, 04:50 PM
  3. make utility
    By studentc in forum C Programming
    Replies: 2
    Last Post: 06-12-2004, 07:59 AM
  4. zip utility
    By SeanMSimonsen in forum Tech Board
    Replies: 2
    Last Post: 04-11-2003, 08:54 PM
  5. Please Try out my Utility Program!!!
    By dgprog in forum C++ Programming
    Replies: 19
    Last Post: 07-20-2002, 10:40 PM