ETX (End of Text) is ASCII code point 3 (0x03), Unicode U+0003. It is a C0 control character that marked the end of a text block on teleprinter links, paired with STX (0x02) to frame the payload between them. In IBM BSC, ETX terminates a data block and signals the receiver to validate the trailing CRC or LRC checksum — if the check passes, ACK (0x06) is returned. Ctrl+C emits 0x03, and Unix repurposed it as the SIGINT signal, making it the most commonly encountered C0 byte in everyday terminal use. That dual meaning — protocol framing relic and process killer — is why raw-mode serial parsers must be careful not to let a stray 0x03 terminate a program instead of closing a data block. UTF-8 encodes it as the single byte 0x03; Unicode classifies it as Cc (Control) with the alias END OF TEXT.
size_t end = 0;while (end < len && buf[end] != 0x03) end++; // scan to ETXif (end < len) payload_len = end; // bytes before ETX
ETX (ASCII 3) marks the end of a text block in protocols. Crucially for developers, Ctrl+C — the universal 'stop mechanism' in Unix terminals — actually sends ETX, which the terminal driver translates into a SIGINT signal.
At the byte level, yes — Ctrl+C generates ASCII 3. But the terminal driver usually intercepts it to send the SIGINT signal to the foreground process. If you put the terminal in 'raw mode', your program will receive the raw 0x03 byte instead.
SIGINT (triggered by Ctrl+C/ETX) is an interrupt request — like politely asking a program to stop now. SIGTERM is a termination signal usually sent by system managers (like `kill` command). Programs can catch and handle both to clean up before exiting.
Many serial protocols frame messages between STX (Start of Text) and ETX. The receiver monitors the stream until it sees ETX, often followed immediately by a checksum (LRC/CRC). This simple framing powers millions of payment terminals and industrial sensors.
It follows Start of Text (ASCII 2). The C0 control codes 1-4 (SOH, STX, ETX, EOT) were designed as a logical sequence for structured messages: Header -> Start Text -> End Text -> End Transmission.