I'm doing some perl scripting stuff on an aprsd (ham radio stuff) server.
I have an example script that can send data to a UDP port of that server,
but i'm usually good at editing bash scripts to make them do what I need,
but I'm new to perl.
I was wondering if someone could look at the script below and insert some
comments in there to help me understand what i'm looking at.
I assume that if you know perl, this script should be quite simple.
Thanks for any advice, I appreciate it!
#!/usr/bin/perl
#Example of how to send data into the APRS server
#via the UDP port from a perl script .
#NOTE: Running this more than once each 30 seconds
#will trigger the duplicate filter in aprsd and your
#packet will be rejected.
#
use Socket;
#$aprsServer = "www.wa4dsy.radio.org";
$aprsServer = "localhost";
$port = 1315;
($d1, $d2, $d3, $d4, $rawserver) = gethostbyname($aprsServer);
$serveraddr = pack("Sna4x8",2,$port,$rawserver);
$prototype = getprotobyname('udp');
socket(SOCKET,2,SOCK_DGRAM,$prototype) || die("No Socket\n");
#Send to the TNC... Note: you must end the string with a NULL
send SOCKET, "N0CLU>TNC:>Testing on RF\0" , 0 , $serveraddr;
#Note that only the data after the ":" is sent to the TNC.
#Send to the Internet...
send SOCKET, "N0CLU>APRS:>Testing on TCPIP\0", 0, $serveraddr;
#Note that the entire string is sent to the internet including
#the path "N0CLU>APRS:".
close(SOCKET);
Adam J. Melancon
_________________________________________________________________
Get reliable dial-up Internet access now with our limited-time introductory
offer. http://join.msn.com/?page=dept/dialup