Port Advertising Help

Port Advertising is a function that allows the NetRS to disclose information about its I/O configuration to selected computers on a network. When the function is enabled, the NetRS will periodically send ASCII formatted UDP packets to a set of targets, each specified by a combinations of an IP address and a UDP port number. By listening for these advertisements, the remote computer can determine the network address of the sending NetRS and which I/O stream capabilities have been enabled on that system.

The idea behind Port Advertising is that an infrastructure system might consist of a centralized server which must control multiple NetRS GPS receivers whose network addresses and configurations might not be completely known or stable. As a example, the NetRS units might use DHCP as a method of setting their network addresses, making it difficult to contact them reliably. If each NetRS is configured to advertise its presence to the server, then the server can build up a table of information about the current configuration of each NetRS. This allows the server to automatically adapt to changing network configurations. For this to work, the server must be at a stable IP address, and must be running software that listens to a user-defined UDP port to detect and process the advertisements. Each NetRS must then be configured to send Port Advertisements to the selected UDP port at the server's known IP address.

The Port Advertising GUI page provides several controls over the Port Advertising function:

When changes are made to the controls, the OK button must be clicked to finalize and save any changes.


Port Advertisement Packets

When enabled, Port Advertisement packets will be sent to the selected targets at the specified intervals. The packets consist of several lines of ASCII text. The exact contents will depend on the details of how I/O ports and the Reference Station controls of the NetRS are configured. Here is a sample packet:
    Mon May 17 22:13:18 UTC 2004
    SystemName: TomsProto
    SerialNumber: 4400000000
    RtcmId: 1023
    BinexID: BNX7
    CmrId: 31
    CmrStationName: CREF0001
    Description: A Verbose Description
    EthernetIP: 192.168.142.174
    HttpPorts: 80
    HttpsPorts: 443 8443
    FtpPort: 21
    RepPort:  3456 Binex
    TcpPort:  1111 Almanacs
    TcpPort:  1234 Rt17
    TcpPort:  2222 SvStatus
    TcpPort:  3333 Ephemerides
    TcpPort:  4567 Cmr
    TcpPort:  5555 Trimcom
    UdpPort:  2345 Rtcm
    UdpPort:  5678 Binex

Each line is terminated with a single newline character ("\n" or linefeed). The first line will always contain the date and time at which the packet was prepared. Note that the time is always in UTC, and not local time or GPS time.

The remaining lines all consist of a key word identifier followed by a colon and a value. The specific keywords and values are documented below. Note that this list may be expanded over time and the order is not guaranteed to remain constant. Software written to parse these packets should be written to be somewhat tolerant of reasonable variations in the formatting.
SystemName: This is the System Name as entered via the Receiver Status - Identity page. This is also usually the system's internet hostname.
SerialNumber: This is the NetRS system serial number, which is a unique identifier for each NetRS. The value is usually a 10 digit numeric value, but is best treated as an arbitary string of 10 characters.
RtcmId: This is a numeric value from 0 to 1023 that is encoded into RTCM reference station messages. Control over this parameter is available via the menu item I/O Configuration - Reference Station.
BinexId: This is a four character identifier that is encoded into some Binex records. Control over this parameter is available via the menu item I/O Configuration - Reference Station.
CmrId: This is a numeric value from 0 to 31 that is encoded into some CMR records. Control over this parameter is available via the menu item I/O Configuration - Reference Station.
CmrStationName: This is an eight character string that is encoded into some CMR records. Control over this parameter is available via the menu item I/O Configuration - Reference Station.
Description: This is a fifty character string that is encoded into some RTCM records. Control over this parameter is available via the menu item I/O Configuration - Reference Station.
EthernetIP: This describes the Internet Protocol address of the Ethernet port on the NetRS.
HttpPorts: This describes which TCP ports are accepting HTTP requests. There can be zero, one or two port numbers, depending on the HTTP configuration.
HttpsPorts: This describes which TCP ports are accepting HTTPS requests. There can be zero, one or two port numbers, depending on the HTTPS configuration.
FtpPorts: This describes which TCP port is accepting FTP requests. If the FTP server is disabled, then no port will be listed.
TcpPort: This describes an I/O port that accepts TCP connections on the indicated port number and provides the indicated service (Binex stream, Almanac data dump, etc.).
UdpPort: This describes an I/O port that accepts UDP triggers on the indicated port number and responds with a UDP stream of the indicated service (Binex stream, Rt17 data, etc.)
RepPort: This describes an I/O port that provides a data stream using the Retry Enhanced Protocol using the indicated port number and stream type.

It should be noted that the IP address(es) of the NetRS are not directly encoded in the advertisement. The address information must be determined by the server which receives the packets, by examining the the UDP datagram information. This is typically provided as a feature in the library functions that are used to read UDP packets. See the sample program below for an example of how this can be done.


Reading Port Advertisements

Customized software must be written to read and make use of Port Advertisement packets. Such software must run on each target server and be able to continuously listen for UDP packets containing the Port Advertisements. The details of such software are beyond the scope of this document. Below is a simple example, written in the Perl language, which waits for packets and displays their contents. This program should operate on numerous platforms and can be used to verify the proper operation of the Port Advertising function. It could also serve as a starting point for a more capable server program.
#! /usr/bin/perl

# UDPrecv.pl
# Listen on a specified port (default=8000).
# Print the source address of any received 
# packets and their contents.

use strict ;

# Default to port 8000.  If the
# user supplies a command line parameter, use that instead.
my $PORTNO = 8000 ; 
if (@ARGV)
{
  $PORTNO = $ARGV[0] ;
}

print "Listening for UDP packets on port $PORTNO\n" ;

use IO::Socket ;
my $server = IO::Socket::INET->new( LocalPort => $PORTNO,
                                    Proto => 'udp' 
                                  ) ;

my $datagram ;
while ( $server->recv( $datagram, 1024, 0 ) )
{
  # Datagram received.  Determine the address of the sender.
  my ( $port, $sender ) = sockaddr_in( $server->peername ) ;
  my $senderName = gethostbyaddr( $sender, AF_INET ) ;

  printf "---Received from %s (%vd) port %d\n", 
         $senderName,
         $sender,
         $port ;
  print $datagram ;
}

Top