[aprssig] Perl socket programming

Andrew Rich vk4tec at people.net.au
Thu Apr 10 09:47:37 EDT 2008


Thanks

I am looking at how to get the position from a GPS, compacting it and 
sending it over a UDP stream.

I found this works.

print $sock chr(34),chr(0),chr(16) instead of print $sock "ABC"

Is there a way I can contruct an array ?

And then got foreach $value

print $sock chr(val) ?



----- Original Message ----- 
From: "Rich Mulvey" <aprs at mulveyfamily.com>
To: "TAPR APRS Mailing List" <aprssig at lists.tapr.org>
Sent: Thursday, April 10, 2008 11:14 PM
Subject: Re: [aprssig] Perl socket programming


> 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
>
>
>
> _______________________________________________
> aprssig mailing list
> aprssig at lists.tapr.org
> https://lists.tapr.org/cgi-bin/mailman/listinfo/aprssig
> 





More information about the aprssig mailing list