[Date Prev][Date Next][Thread Prev][Thread Next] - [Date Index][Thread Index][Author Index]

Nova TCP server

BTW, Nova has a new TCP server function which provides similar information
to the DDE strings but the cool thing is that it is TCP based - you access
it via the network. This opens up the world of distributed tracking and
tuning - I.E. Nova GUI running on a Windows PC and the tracking/tuning
application on LINUX or a Mac or SBC. Below is a sample Perl script to
access it - just call it with the DNS name of the PC running Nova once you
have the TCP server setup in Nova. You can also just telnet to port 8090 on
the Nova PC to test.

I believe Predict on Linux has this capability also but I like the Nova


$| = 1;

($them,$port) = @ARGV;
$them = 'novapc' unless $them;
$port = 8090 unless $port;

$AF_INET = 2;
$SOCK_STREAM = 2; # 2 for SYS V and 1 for others

$SIG{'INT'} = 'dokill';
sub dokill {
 kill 9, $child if $child;

$sockaddr = 'S n a4 x8';

chop($hostname = `hostname`);

($name,$aliases,$proto) = getprotobyname('tcp');
($name,$aliases,$port) = getservbyname($port,'tcp')
 unless $port =~ /^\d+$/;;
($name,$aliases,$type,$len,$thisaddr) =
($name,$aliases,$type,$len,$thataddr) = gethostbyname($them);

$this = pack($sockaddr, $AF_INET, 0, $thisaddr);
$that = pack($sockaddr, $AF_INET, $port, $thataddr);

# Make the socket file handle

if (socket(S, $AF_INET, $SOCK_STREAM, $proto)) {
 print "socket ok\n";
else {
 die $!;

#Give the socket an address

if (bind(S, $this)) {
 print "bind ok\n";
else {
 die $!;

# Call up the server

if (connect(S,$that)) {
 print "connect ok\n";
else {
 print "connect to $port at $them failed\n";
 die $!;

# Set socket to be command buffered.

select(S); $| = 1; select(STDOUT);

# Avoid dedlocking by forking.

if($child = fork) {
        while (<STDIN>) {
                print S;
        sleep 2;
else {
        while(<S>) {


Don Woodward
AMSAT 33535

Sent via amsat-bb@amsat.org. Opinions expressed are those of the author.
Not an AMSAT member? Join now to support the amateur satellite program!
To unsubscribe, send "unsubscribe amsat-bb" to Majordomo@amsat.org