Position-report data for Sailmail can be obtained from Expedition, a popular program for ocean racing and cruising. Expedition can be running on the same computer, or connected via a wired or WiFi network. Data is shared by creating a new network connection in Expedition to send the data in NMEA-0183 format, and setting up Airmail’s Position Reports module to receive the data. Data can be sent either via TCP or UDP network connections, see below.
To make data available from Expedition, you first need to create a network connection in Expedition for sending data. The “Instruments” window shows available COM-ports, plus a specified number of network ports. To send data we need one additional network port, which can be used to either send data via UDP or create a TCP server to allow Airmail to connect and receive data.
The difference between TCP and UDP is that data sent over a TCP client-server connection is checked, acknowledged, and re-sent as needed. For UDP, data is sent “blind” without checking and can be lost. For navigation data, occasional data loss is not a big problem because the data always repeats at frequent intervals. And the advantage of broadcast UDP is that the data is available to everyone connected to the network. The problem is that WiFi networks struggle with broadcast UDP data, and some WiFi networks block broadcast UDP altogether. In this case, using a TCP connection is the answer.
To create a new Network Port, click the Expedition system-menu (the 3-bar menu above “settings” in the upper-left). Move the mouse over “Instruments” but don’t click– clicking will open the Instruments window, but first we need to create a new network entry for the Instruments window. Hovering over “Instruments” will bring up a sub-menu, select “Number of network connections”. Increment the connection-count by one: if zero, enter 1.
To set up a TCP server, open the Instruments panel (ctrl-i, or click on “Instruments” in the system-menu) and select the new network connection. Enter something like “tcp server” as the alias, select “NMEA 0183” for Instruments, select “TCP server” as the connection. The address box will be grayed-out so ignore it, enter port 10110 or whatever you like, no check-mark for “tx on port+1”. Click “Apply” but leave that window open. (In this example our outgoing “tcp server” network is “Network 1” because Network-0 is used for UDP input from a multiplexer).
Output data sentences must be enabled or nothing will be sent. Click the “NMEA 0183 settings” button (lower right) and find “NMEA sentences to send” on the right. Check the boxes that you want, or just check them all– Airmail will ignore anything it doesn’t want. Click OK to save the settings and close the NMEA settings window, and OK again to close the Instruments window.
UDP output can also be used from Expedition, select “UDP” (or “UDP to IP address” for a specific address). Selecting “UDP” will broadcast to all devices and programs on the network (WiFi willing), while “UDP to IP address” will send directly to a specified IP address.
In this example, “UDP to IP address” is selected to send data to another computer over a WiFi network which blocked UDP broadcast messages. To send to another program only on the same computer as Expedition, use the “localhost” address 127.0.0.1. And again, be sure to enable the desired (or all) sentences for sending.
Another option is to set up both Data Server and a UDP connection. This is literally as simple as setting up both connections as described above. This allows other programs to connect either via TCP or UDP based on capabilities and network configuration. The same port number can be used for both connections, as TCP and UDP ports are separate.
To set up Airmail, open the Position Report window (from Airmail’s Window menu), find “Data input” near the bottom, and click on the “Setup” button. This opens an “Airmail Data Input” window. Click “Settings” or “Advanced settings”, select TCP (or UDP), and enter the same port number as used for the source above. (“TCP server” here is confusing, it means “connect to a TCP server as a client”). For a TCP connection, if Expedition is running on the same computer then leave the address box blank or enter “127.0.0.1” or “localhost”, and if the TCP source is a different computer or device then enter its IP address. For UDP leave the address blank, UDP will receive data from any source on the specified port.
Note that Airmail prior to 3.5.060 doesn’t gracefully share UDP ports. So sending data from Expedition to Airmail on the same computer will work fine (and should be reliable), but trying to send to multiple receiving programs may not work– Airmail may not be able to open the port. Updating Airmail or using the TCP server option above will avoid this issue.
Note also that a “UDP Broadcast” as described above will generally not be forwarded through a WiFi network but UDP can be directed to a specific IP address (instead of being broadcast), and this will generally work. This is not an issue with most wired network connections, and using a TCP client/server connection will avoid the whole issue.