[aprssig] Perl socket programming

Rich Mulvey aprs at mulveyfamily.com
Thu Apr 10 09:14:05 EDT 2008


Andrew Rich wrote:
> Any one good at socket programming ?
>  
> I am trying to UDP some hex characters.
>  
> Something so simple is turning out to be hard to find.
>  
> Here is how to do it as a string, I just want to send hex instead
>  
> #!/usr/bin/perl -w
> # clientIO.pl - a simple client using
> # IO::Socket
> use strict;
> use IO::Socket;
> my $host = shift || 'localhost';
> my $port = shift || 30003;
> my $sock = new IO::Socket::INET(
>                    PeerAddr => $host,
>                    PeerPort => $port,
>                    Proto    => 'udp');
> $sock or die "no socket :$!";
> foreach my $i (1..10) {
>     print $sock "hello, world: $i\n";
> sleep 1;
> }
> close $sock;                    


print unpack( "H*", "Hello World $i" ) . "\n";


Though I'm at a bit of a loss as to what this has to do with APRS...


- Rich






More information about the aprssig mailing list