TCP vs UDP: Configuring NMEA0183 Talker Listener (10110/TCP vs UDP-based)
The National Marine Electronics Association (NMEA) has developed a standard for communication between marine electronics devices called NMEA0183. This standard allows devices to communicate with each other using a common set of messages known as NMEA sentences. In order to facilitate communication between two devices using NMEA0183, one device acts as a "talker" and the other acts as a "listener."
NMEA0183 Talker
An NMEA0183 talker is a device that sends NMEA sentences over a serial or network connection. In this example, we will be using a machine with the IP address 192.168.11.100 as the NMEA0183 talker. This machine will be sending NMEA strings over port 10110 using the TCP protocol.
NMEA0183 Listener
An NMEA0183 listener is a device that receives NMEA sentences over a serial or network connection. In this example, we will be using a machine with an arbitrary IP address (let's say 192.168.11.110) as the NMEA0183 listener. This machine will be receiving NMEA strings using either the TCP or UDP protocol.
TCP vs UDP
TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) are two different protocols used for sending data over a network. TCP is a connection-oriented protocol, which means that a connection must be established between the sender and the receiver before data can be sent. This connection is maintained throughout the duration of the data transfer, and data is sent in a reliable, ordered manner.
UDP, on the other hand, is a connectionless protocol. This means that data can be sent without establishing a connection beforehand. However, data sent using UDP is not guaranteed to be delivered, and there is no guarantee that the data will be delivered in the order it was sent. UDP is often used for applications that require low latency and can tolerate some data loss, such as streaming audio or video.
Configuring the NMEA0183 Talker
To configure the NMEA0183 talker on the machine with the IP address 192.168.11.100, you will need to use a terminal emulator program such as PuTTY or Minicom. Connect to the machine using the terminal emulator and enter the following commands:
$ stty -F /dev/ttyS0 4800 cs8 -cstopb -parenb
$ echo -ne "$'\r
'" > /dev/ttyS0
$ socat -d -d pty,raw,echo=0,link=/dev/nmea0183 TCP4:192.168.11.100:10110
These commands configure the serial port (/dev/ttyS0) to use the NMEA0183 baud rate (4800), 8 data bits, no stop bits, and no parity. They also create a Unix domain socket (/dev/nmea0183) that is connected to the TCP connection on port 10110 of the machine with the IP address 192.168.11.100.
Configuring the NMEA0183 Listener
To configure the NMEA0183 listener on the machine with an arbitrary IP address, you will need to use a terminal emulator program such as PuTTY or Minicom. Connect to the machine using the terminal emulator and enter the following commands:
TCP-based Listener
$ stty -F /dev/ttyS0 4800 cs8 -cstopb -parenb
$ socat -d -d TCP4-LISTEN:10110,fork pty,raw,echo=0,link=/dev/nmea0183
These commands configure the serial port (/dev/ttyS0) to use the NMEA0183 baud rate (4800), 8 data bits, no stop bits, and no parity. They also create a Unix domain socket (/dev/nmea0183) that is connected to the TCP listener on port 10110 of the local machine.
UDP-based Listener
$ stty -F /dev/ttyS0 4800 cs8 -cstopb -parenb
$ socat -d -d UDP4-RECVFROM:10110,fork pty,raw,echo=0,link=/dev/nmea0183
These commands configure the serial port (/dev/ttyS0) to use the NMEA0183 baud rate (4800), 8 data bits, no stop bits, and no parity. They also create a Unix domain socket (/dev/nmea0183) that is connected to the UDP receiver on port 10110 of the local machine.
- NMEA0183 is a standard for communication between marine electronics devices.
- An NMEA0183 talker is a device that sends NMEA sentences, and an NMEA0183 listener is a device that receives NMEA sentences.
- TCP and UDP are two different protocols used for sending data over a network. TCP is connection-oriented and reliable, while UDP is connectionless and unreliable.
- To configure the NMEA0183 talker on a machine with the IP address 192.168.11.100, use the following commands:
$ stty -F /dev/ttyS0 4800 cs8 -cstopb -parenb
$ echo -ne "$'\r '" > /dev/ttyS0
$ socat -d -d pty,raw,echo=0,link=/dev/nmea0183 TCP4:192.168.11.100:10110
- To configure the NMEA0183 listener on a machine with an arbitrary IP address, use the following commands for a TCP-based listener:
Or the following commands for a UDP-based listener:$ stty -F /dev/ttyS0 4800 cs8 -cstopb -parenb
$ socat -d -d TCP4-LISTEN:10110,fork pty,raw,echo=0,link=/dev/nmea0183
$ stty -F /dev/ttyS0 4800 cs8 -cstopb -parenb
$ socat -d -d UDP4-RECVFROM:10110,fork pty,raw,echo=0,link=/dev/nmea0183