The Path
Module 4 · Transport and acknowledgements·11 min
How a message travels
Files, MLLP over TCP, start and end characters, ports: the actual journey.
A polysomnography result does not teleport into the patient record. It leaves one computer, crosses the clinic network and lands on another. In between, you need a few very simple rules to tell where each message starts and where it ends.
Here is the message about to travel: the sleep lab sends Marie Dubois’s AHI to the hospital record.
A sleep study report. The lab sends the hospital record an AHI of 28.5/h, flagged “high”: moderate sleep apnea.
MSH-3 says who is sending (SLEEPLAB), MSH-5 who it is for (HIS). But the message itself says nothing about how it travels. That is the transport layer’s job.
Two ways to move a message
File drop. The sender writes the message to a file, in a shared folder or on an SFTP server. The receiver polls the folder at regular intervals. Simple and robust, but never instant.
Network connection. The two systems stay connected over TCP and messages go out one by one, in real time. This is the classic way HL7 v2 moves around a hospital, using a tiny protocol: MLLP.
The problem: TCP knows nothing about messages
TCP carries a stream of bytes, like a pipe. It guarantees the bytes arrive in order, but it has no idea what your messages are. If the lab sends three results in a row, the hospital record receives one long ribbon of text. Where does the first one stop?
You might think of the carriage return. But it is already taken: in HL7 v2, every segment ends with a carriage return (CR, 0x0D). It separates lines, not messages.
MLLP: one byte before, two bytes after
The Minimal Lower Layer Protocol wraps each message in a block:
| Position | Byte | Name | Role |
|---|---|---|---|
| Block start | 0x0B |
VT | “a message starts here” |
| Content | the HL7 message | segments separated by CR |
|
| Block end | 0x1C |
FS | “the message is over” |
| Right after | 0x0D |
CR | closes the block |
On the wire, our result looks like this, shortened (control bytes are written between angle brackets because they are invisible on screen):
<VT>MSH|^~\&|SLEEPLAB|LELEUX|HIS|LELEUX|20260627083000||ORU^R01^ORU_R01|MSG00001|P|2.5.1<CR>
PID|1||1024^^^LELEUX^MR||DUBOIS^Marie^^^^^L||19850312|F<CR>
OBX|1|NM|AHI^Apnea-hypopnea index^L||28.5|/h^per hour|<5|H|||F<CR>
<FS><CR>
The receiver reads bytes until it hits <FS><CR>. Everything between <VT> and <FS> is one message.
One message, one ACK, then the next
Messages follow each other on the same connection, but not in a burst. A well-behaved sender sends message N, waits for its acknowledgement, and only then sends N+1. That is what guarantees order: Marie Dubois’s admission always arrives before her update, and her discharge after both.
Sending one at a time has a consequence. If the ACK does not come back, or comes back as an error, the sender cannot just move on to the next message without breaking the order. The next lesson, on acknowledgements, covers the two options: block the queue, or set the message aside.
Sleep lab
MLLP client
Patient record
server, port 2575
- TCP: connect
- <VT> ORU^R01 <FS><CR>
- <VT> ACK · AA <FS><CR>
- <VT> ORU^R01 (next) <FS><CR>
Client, server and port
An MLLP connection has two roles:
- the server (usually the receiver) opens a port and waits;
- the client (usually the sender) connects to that port, then sends its blocks.
The receiver’s reply, the acknowledgement, comes back over the same connection, framed the same way. That is the next lesson.
Persistent connection or one per message
Most interfaces keep the connection open all the time. Some open and close it for every message. Both work, but you need to know which one you have.
The most common failure is not a forgotten byte. It is a half-open connection: a firewall drops a session that sat idle, and the sender still believes it is connected. So plan for it, and write it into the specification:
- an ACK timeout (how many seconds before you decide the ACK is not coming);
- automatic reconnection when the connection drops;
- what happens after several failures: retry, alert.
The official IANA port registry assigns the name hl7 to port 2575. Nothing forces you to use it, though: the port is a setting agreed between the two teams. One port per feed is easier to monitor.
Batch files: FHS, BHS, BTS, FTS
When messages move as files, you can bundle many of them. HL7 v2 defines four envelope segments for this:
FHS file header
BHS batch header
MSH ... one message
MSH ... another message
BTS batch trailer (with the message count)
FTS file trailer (with the batch count)
You will meet them in file transfers, rarely on a real-time connection.
Bytes, not letters
MLLP carries bytes, not characters. How those bytes turn into accented letters (UTF-8, ISO 8859-1, Windows-1252) is set by MSH-18 and by the configuration on both sides. For an “é” or a “ç”, this is often the problem of week one: the “Character sets and accents” lesson shows it in detail.
What about the web?
Interface engines can also move an HL7 v2 message over HTTP(S), or even through a SOAP web service. The content stays the same pipe-delimited message: only the delivery method changes. FHIR, on the other hand, was built for the web from day one (module 6).
Check your understanding
1 of 4Which byte opens an MLLP-framed message?
+50 XPPass the quiz (3 correct answers) to complete the lesson.
Reviewed and checked on 28 September 2026