Skip to content

Discovery Protocol

GhostTypes edited this page Sep 7, 2026 · 7 revisions

Discovery Protocol

FlashForge printers use UDP-based discovery protocols to announce their presence on the network. A client implementation must handle both modern and legacy protocols to support the full printer fleet.

Protocol Overview

Family Protocol Type Ports Packet Size Key Identifier
Modern (5M / 5M Pro / AD5X / Creator 5) UDP Broadcast & Multicast 19000 (Multi), 48899 (Broad) 276-280 bytes Serial Number (Offset 0x92)
Legacy (A3 / A4 Pro) UDP Multicast 8899 140 bytes Machine Name (Offset 0x00)

Multicast Group: 225.0.0.9

Modern Protocol (5M / 5M Pro / AD5X / Creator 5)

Discovery Mechanism

Modern printers listen on both multicast and broadcast addresses:

Type Address Port
Multicast 225.0.0.9 19000
Broadcast 255.255.255.255 48899

Probe: Send any UDP packet (payload ignored) to either address.

Response: Fixed-size binary packet. The size depends on the firmware generation:

Firmware Packet Size
3.x (5M / 5M Pro / AD5X) 276 bytes (0x114)
5.x (5M / 5M Pro) 280 bytes (0x118)
Creator 5 / Creator 5 Pro (all firmware) 276 bytes (0x114)

Firmware 5.x appends four trailing bytes after the Serial Number field. Check the length as "276 or more". Never check for one exact size. Creator 5 and Creator 5 Pro always send 276 bytes.

Packet Structure

Total Size: 276 bytes (0x114) on firmware 3.x. 280 bytes (0x118) on firmware 5.x. (Big Endian)

Offset Size Type Description
0x00 128 char[] Machine Name (null-terminated)
0x80 4 bytes Padding (zeroed)
0x84 2 uint16 Command Port (TCP), typically 8899. Creator 5 and Creator 5 Pro report 8899 here. They run no TCP server. Use the HTTP/Event port instead
0x86 2 uint16 VID - typically 0x2B71
0x88 2 uint16 PID - model specific, see Printer PIDs
0x8A 2 uint16 Status Code - 0=Ready, 1=Busy, 2=Error
0x8C 2 uint16 Product Type (e.g., 0x5A02). Every 5M-platform model uses this value, including AD5X and Creator 5. Use the PID at 0x88 to tell the models apart
0x8E 2 uint16 HTTP/Event Port - typically 8898
0x90 2 bytes Reserved
0x92 128 char[] Serial Number (null-terminated)
0x112 2+ bytes Firmware 3.x and Creator 5: padding. Firmware 5.x (5M / 5M Pro): product type repeated (2 bytes), fixed 0x01 (1 byte), padding

Status Code Field

The status code at 0x8A shows basic printer state: 0 = Ready, 1 = Busy, 2 = Error. The printer updates this value only in a new discovery packet. This is a snapshot, not a live push. Poll /detail status for the current state.

Detection Logic

If a packet is 196 bytes (0xC4) or longer, parse it as the modern protocol.

Legacy Protocol (Adventurer 3 / 4 Pro)

Discovery Mechanism

Legacy printers listen on multicast only:

Type Address Port
Multicast 225.0.0.9 8899

Probe: Send any UDP packet to the multicast address.

Response: Fixed-size binary packet (140 bytes).

Packet Structure

Total Size: 140 bytes (Big Endian)

Offset Size Type Description
0x00 128 char[] Machine Name (null-terminated)
0x80 4 bytes Padding (zeroed)
0x84 2 uint16 Command Port (TCP) - typically 8899
0x86 2 uint16 Vendor ID - typically 0x2B71
0x88 2 uint16 Product ID - e.g., 0x001D
0x8A 2 uint16 Status Code (0=Ready, 1=Busy, 2=Error)

Detection Logic

If a packet is exactly 140 bytes, parse it as the legacy protocol.

Important Limitation

The legacy packet does not contain the Serial Number. To retrieve the SN for unique identification, you must:

  1. Connect via TCP to port 8899
  2. Send ~M115
  3. Parse the Serial Number from the response

Unified Implementation Strategy

To auto-discover any FlashForge printer:

1. Create UDP Socket

Bind a UDP socket capable of receiving from multiple interfaces.

2. Send Probes

Send discovery probes to all known addresses:

225.0.0.9:19000   (Modern Multicast)
255.255.255.255:48899   (Modern Broadcast)
225.0.0.9:8899    (Legacy Multicast)

3. Parse Responses

Parse responses based on packet length:

Packet Length >= 196  --> Modern Protocol
Packet Length == 140  --> Legacy Protocol

Modern packets are 276 bytes on firmware 3.x and 280 bytes on firmware 5.x. Accept both lengths.

4. Handle Legacy Printers

For legacy printers, initiate a TCP connection to retrieve the serial number.

Discovery Response Summary

Field Modern (276 bytes) Legacy (140 bytes)
Machine Name Yes (offset 0x00, 128B + 4B pad) Yes (offset 0x00, 128B + 4B pad)
Serial Number Yes (offset 0x92, 128B + 2B pad) No (requires TCP)
Command Port Yes (offset 0x84) Yes (offset 0x84)
HTTP/Event Port Yes (offset 0x8E) No
Status Code Yes (offset 0x8A) Yes (offset 0x8A)
VID/PID Yes (offsets 0x86, 0x88) Yes (offsets 0x86, 0x88)
Product Type Yes (offset 0x8C) No

Troubleshooting

No Responses Received

  1. Verify the printer is powered on and connected to the network
  2. Check that firewall settings allow UDP traffic on the discovery ports
  3. Ensure your computer is on the same network segment as the printer
  4. Try direct IP connection if discovery fails

Multiple Responses

A single printer may respond to multiple probe addresses. Use the IP address or serial number to deduplicate responses.

Legacy Printer Identification

For legacy printers, always fetch the serial number via TCP ~M115 before caching or displaying printer details. The machine name alone may not be unique across multiple printers.

Clone this wiki locally