Skip to content
Contact Us

MLLP: Minimum Lower Layer Protocol for HL7

HL7 MLLP (Minimum Lower Layer Protocol) is the standard TCP transport wrapper for HL7 v2 messages. It defines the framing characters that delimit where one HL7 message ends and the next begins on a persistent TCP connection. Nearly every HL7 v2 interface in production uses MLLP — it is the default transport for integration engines like Mirth Connect, Rhapsody, and Cloverleaf.

Each HL7 message is wrapped in three framing characters:

<SB> [HL7 Message Data] <EB><CR>
CharacterHexNamePurpose
SB0x0BStart Block (Vertical Tab)Marks the beginning of an HL7 message
EB0x1CEnd Block (File Separator)Marks the end of the HL7 message
CR0x0DCarriage ReturnImmediately follows EB to signal frame complete

A complete MLLP frame on the wire (hex representation):

0B ← Start Block
4D 53 48 7C 5E 7E 5C 26... ← MSH|^~\&|... (HL7 message bytes)
0D ← Segment delimiter (CR between segments)
50 49 44 7C 31 7C... ← PID|1|... (next segment)
0D ← Segment delimiter
... ← Additional segments
1C ← End Block
0D ← Carriage Return (frame complete)

Within the message, segments are separated by 0x0D (carriage return). The outer framing (0x0B0x1C 0x0D) wraps the entire message including its internal segment delimiters.

The standard MLLP pattern maintains a long-lived TCP connection. Connection pooling and keepalive timers maintain the connection during idle periods.

Persistent MLLP Connection
Sender EHR / Source System
Listener Integration Engine
TCP Connect
MLLP Message #1 SB + HL7 Data + EB + CR
MLLP ACK #1 SB + ACK + EB + CR
MLLP Message #2 Connection stays open
MLLP ACK #2
TCP Close On shutdown or error only
client server
TCP Connect
client server
MLLP Message #1 SB + HL7 Data + EB + CR
server client
MLLP ACK #1 SB + ACK + EB + CR
client server
MLLP Message #2 Connection stays open
server client
MLLP ACK #2
client server
TCP Close On shutdown or error only

Some implementations open a new TCP connection for each message. Less efficient but simpler to implement and more resilient to network interruptions. Some firewalls and load balancers prefer this pattern.

Connection-Per-Message
Sender Source System
Listener Integration Engine
TCP Connect
MLLP Message SB + HL7 Data + EB + CR
MLLP ACK
TCP Close Connection closed after each message
client server
TCP Connect
client server
MLLP Message SB + HL7 Data + EB + CR
server client
MLLP ACK
client server
TCP Close Connection closed after each message
RoleDescriptionTypical System
Listener (Server)Binds to a port and waits for connectionsIntegration engine receiving messages
Sender (Client)Initiates TCP connection to a listenerEHR or ancillary system sending messages

Most integration engines can operate in both roles simultaneously — listening for inbound messages on some channels while sending outbound messages on others.

MLLP has no officially assigned port number. Common conventions:

Port RangeUsage
2575HL7 registered port (IANA), rarely used in practice
5000-5999Common range for custom MLLP listeners
6000-6999Alternate range, often used in multi-channel setups
8000-8999Sometimes used alongside HTTP interfaces

In multi-interface environments, each channel typically gets its own port (e.g., ADT on 5001, ORU on 5002, ORM on 5003).

Securing HL7 transport with TLS (formerly SSL) encrypts the MLLP connection:

SettingRecommendation
TLS VersionTLS 1.2 minimum; TLS 1.3 preferred
CertificateX.509 certificate from trusted CA or internal PKI
Mutual TLSRecommended — both client and server present certificates
Cipher SuitesDisable weak ciphers (RC4, DES, 3DES)

The MLLP framing is identical inside the TLS tunnel — the encryption is transparent to the HL7 message layer.

MLLP over TLS Handshake
MLLP Client TLS Initiator
MLLP Server TLS Responder
TCP SYN/ACK TCP connection established
ClientHello Supported ciphers & TLS version
ServerHello + Certificate Selected cipher & server cert
Client Certificate Mutual TLS (if required)
Recommended for healthcare — both parties verify identity
Key Exchange + Finished
Finished Encrypted tunnel established
MLLP Message Encrypted HL7 data
MLLP ACK Encrypted acknowledgment
client server
TCP SYN/ACK TCP connection established
client server
ClientHello Supported ciphers & TLS version
server client
ServerHello + Certificate Selected cipher & server cert
client server
Client Certificate Mutual TLS (if required) Recommended for healthcare — both parties verify identity
client server
Key Exchange + Finished
server client
Finished Encrypted tunnel established
client server
MLLP Message Encrypted HL7 data
server client
MLLP ACK Encrypted acknowledgment

HIPAA requires encryption of PHI in transit. MLLP over TLS satisfies this requirement for HL7 v2 interfaces. Without TLS, HL7 messages containing patient data travel in cleartext — a HIPAA violation if the network is not otherwise secured (e.g., dedicated VLAN with network-level encryption).

Mirth Connect is the most widely used open-source integration engine for MLLP:

Inbound (Listener):

  • Source connector type: TCP Listener
  • Transmission mode: MLLP
  • Local port: (assigned port number)
  • Response: Auto-generate ACK or custom response

Outbound (Sender):

  • Destination connector type: TCP Sender
  • Transmission mode: MLLP
  • Remote host/port: (destination address)
  • Queue on failure: Enabled (prevents message loss)
ParameterRecommended ValuePurpose
Receive timeout30-120 secondsHow long to wait for a complete message
Response timeout30-120 secondsHow long to wait for an ACK
Reconnect interval10-30 secondsDelay between reconnection attempts
Max retry count3-5Maximum retransmission attempts
Keep connection openYesPersistent connection (default)
Queue buffer sizeBased on volumeMessages queued during outages
EncodingUsage
ASCIIDefault for most HL7 v2 interfaces
UTF-8Required for international character sets (accented names, CJK characters)
ISO 8859-1Latin-1, sometimes used in European implementations

The encoding must match between sender and receiver. MSH-18 declares the character set, but many interfaces assume ASCII and don’t check MSH-18.

MLLP itself has no message size limit, but practical limits exist:

  • Large ORU messages: Pathology reports with embedded PDFs can exceed 1MB
  • Large MDM documents: Full clinical documents may be several MB
  • Buffer allocation: Receiving systems must allocate sufficient buffer to hold the entire message before processing

Integration engines typically have configurable maximum message size settings (default often 10-50MB).

Production MLLP connections must handle network interruptions:

  • TCP keepalive: Enable OS-level keepalive to detect dead connections (typical interval: 60-120 seconds)
  • Reconnection logic: Automatic reconnection with exponential backoff
  • Queue persistence: Messages queued during outages must survive engine restarts (disk-backed queues)
  • Monitoring: Alert on connection drops, ACK timeouts, and queue depth exceeding thresholds

Healthcare networks often have strict firewall rules:

  • Static ports: MLLP uses fixed port numbers — request firewall rules for each interface
  • Bidirectional: If both systems send and receive, open ports in both directions
  • NAT traversal: Persistent MLLP connections may be dropped by stateful firewalls with idle timeouts — use TCP keepalive to prevent this
  • VPN tunnels: Cross-organization interfaces often require site-to-site VPN before MLLP traffic flows