DataReelDataReelC++ Toolkit Documentation

gxStream and Replication on Port 2073 (White Paper)

Release: DataReel 7.4 (the 7.4.1 branch), 11/18/2026. Audience: network and security reviewers, firewall administrators, and developers who write gxStream clients and servers or run DataReel replication. Everything in this paper was written from the DataReel 7.4 source: include/gxstypes.h, include/gxheader.h, include/gxstream.h, src/gxstream.cpp, include/gxstls.h, src/gxstls.cpp, include/gxdbserver.h, src/gxdbserver.cpp, include/gxdbmux.h, src/gxdbmux.cpp, include/gxdbobject.h, src/gxdbobject.cpp, include/gxobjrepl.h and src/gxobjrepl.cpp. When this paper and the code disagree, the code wins.

The exact wire format, with every field, is in the protocol specification (docs/rfc/draft-gaer-datareel-gxstream-00.txt, an Internet-Draft for the Independent Submission stream). The security design of the library as a whole is in the DataReel security white paper.

1. Port 2073

TCP and UDP port 2073 are registered with IANA for DataReel under the service name gxs-data-port, "DataReel Database Socket". The registration was made in the 1990s, when a protocol description was not required with it; this paper and the specification are that description. The DataReel source has carried the services file entries since its early releases (include/gxstypes.h):

gxs-data-port   2073/tcp   DataReel Database Socket
gxs-data-port   2073/udp   DataReel Database Socket

and the port number as constants (gxsDATA_PORT, gxSOCKET_DBS_PORT, gxSOCKET_DEFAULT_PORT, all 2073).

What uses it in DataReel 7.4:

UsePort 2073Where
gxStream clientsthe default of gxStream::Connect()gxstream.h
The database object serverthe default listen_portgxdbserver.h
Remote database objects (object service)carried by the database object servergxdbobject.h
Vector searches (7.4)carried by the object servicegxdbobject.h
6.x style clients (legacy add/request blocks)carried by the object servicegxdbobject.h
Object replication (gxObjRepl)the default port of the copy and of the primary's copy address (7.4.1)gxobjrepl.h

UDP is not used by DataReel 7. The UDP registration is for the legacy DataReel 6.x class gxDatagram, which sends the same blocks over UDP (one datagram for the header and one for the body) in cleartext and with no peer authentication. DataReel 6.x gxStream can also run over plain TCP when a server explicitly opts out of client authentication. Both are legacy transports, described in the specification for completeness and not recommended.

Why a registered port. gxStream is a long-lived service protocol between hosts that are configured once and then left alone: a database server, its clients and a replication pair. A fixed, registered port lets the services files, firewall rules, SELinux port labels and network monitoring name the traffic as DataReel database traffic, lets clients connect without being told a port, and keeps DataReel from colliding with another program's choice of an unregistered port. gxStream has been DataReel's database block protocol since 1999, and 2073 its port since the registration.

2. The layers

 +-------------------------------------------------------------+
 | Services: object service (op 1-8), vector search, legacy    |
 | add/request blocks, object replication frames               |
 +-------------------------------------------------------------+
 | Multiplex (optional): channels with credit flow control     |
 +-------------------------------------------------------------+
 | gxStream blocks: 32-byte header + body                      |
 +-------------------------------------------------------------+
 | TLS 1.2 or 1.3, certificates on both sides                  |
 +-------------------------------------------------------------+
 | TCP, port 2073                                              |
 +-------------------------------------------------------------+

3. The gxStream block

Every block starts with the same header, the one gxDatabase writes before every block in a database file. On the wire it is four 8-byte little endian words, the same on every platform since DataReel 7.4:

  0               8               16              24              32
 +---------------+---------------+---------------+---------------+
 |  check word   |    length     |    status     |    result     |
 +---------------+---------------+---------------+---------------+
WordContents
check word0xFEFE; anything else is a synchronization error
lengththe number of body bytes that follow (0 for a header-only block)
statusbyte 0: the block's data status, V (a block from a remote device); byte 1: the control code (below); the other bytes are 0
resulta 64-bit result value carried in a header-only acknowledgment (a file address, for example); otherwise 0

The high four bytes of the check word and the status words are always 0. A DataReel peer older than 7.4 beta 5 on 64-bit Windows, or a 32-bit build, sent 4-byte words (a 24 or 16 byte header); a 7.4 receiver sees non-zero bytes there and refuses the connection instead of misreading it.

Control codes (status byte 1) used on the wire in 7.4:

CodeNameMeaning
Ssend blocka body of data: a reply, a multiplex frame or a replication frame
Rrequest blocka request; the body names what is wanted (an 8-byte object address for the legacy object service)
Aadd blockadd the body as a new object; the reply is a result block with its address
Cchange blockchange an object; the request block is followed by an S block with the new contents
Ddelete blockdelete the object the body names
Wacknowledgea header-only acknowledgment; the result word carries the result
Lclose connectionthe client is done
Kkill serverask the server to shut down
Trestart serverask the server to restart

A receiver checks the length against its maximum block size (64 MB by default, 17 MB on the database object server) before it allocates anything, and refuses a header with a wrong check word or an oversize length. The K and T codes are defined by the protocol; the 7.4 database object server does not act on them (a session that sends one is closed), and programs that offer them must restrict them to administrators.

4. The database object server

gxDatabaseServer is one TLS listener on port 2073 shared by several services:

1. The accept loop takes the TCP connection only. The TLS handshake runs in its own thread with a 10 second limit, at most 16 at once, so a scanner or a silent connection cannot keep real clients out. 2. A client whose certificate fails the CA or allow list check is closed. At most max_clients (4 by default) authenticated sessions run at once. 3. The server reads the session's first block and gives the session to the first service that claims it:

5. The multiplex

A multiplex session carries numbered channels over one connection. Each frame is one S block whose body starts with an 18-byte frame header:

 byte 0   'M' (0x4D), the multiplex mark
 byte 1   kind
 bytes 2-5    channel (u32)
 bytes 6-13   sequence number (u64)
 bytes 14-17  flags (u32; bit 0 = the last frame of a message)
 then the payload
KindPayloadMeaning
1 HELLOstr "GXDBMUX", u32 version (1)first frame of each side, on channel 0
2 OPENstr service, str name, str mode, u64 creditopen a channel to a database (object, the database name, read or write)
3 OPENEDu64 credit, bytes extrathe channel is open
4 REFUSEDstr reasonthe channel was not opened
5 DATAservice datapart of a message
6 CREDITu64 bytesthe receiver has room for this many more bytes
7 ACKu64 seq, u64 lsna durable apply up to seq
8 ERRORstr reasoncloses the channel
9 CLOSEnonecloses the channel; on channel 0, the connection

(str: a 4-byte length and the bytes; bytes: an 8-byte length and the bytes.)

6. The object service

On an open object channel each message (DATA frames up to the one with the last-frame flag) is one request: a 1-byte operation and its arguments. The reply is one message: a status byte (0 ok, 1 error), then the result or an error string.

OpRequestReply
1 ADDbytes datau64 address
2 REQUESTu64 addressbytes data
3 CHANGEu64 address, bytes data (the same length as the object)nothing
4 DELETEu64 addressnothing
5 FIRSTnothingu64 address of the first object (0: none)
6 NEXTu64 addressu64 address of the next object (0: none)
7 VECTOR_SEARCHversion, k, ef, dim, filters, query floatsnearest neighbors with distances and tags
8 VECTOR_INFOnothingthe vector index's dimension, type, metric and counts

A database opened write changes through its journal, one transaction per request. A database that is a replicated copy is read-only, and every read holds the copy's apply lock so it never sees half of a commit.

Legacy clients. A DataReel 6.x style client that sends an A block (add) gets a W result block with the new object's address in the result word; an R block with an 8-byte address gets an S block with the object; L ends the session. These work only on a server that names a legacy database, and over TLS with a client certificate like every other client.

7. Object replication (gxObjRepl)

gxObjRepl keeps a copy of a primary's object databases on a second node. Only objects travel, never file pages: each node keeps its own file addresses, free space and indexes, so the two nodes can be different platforms (Linux and Windows, in either direction).

7.1 The stream

The primary connects to the copy over gxStream with mutual TLS: the copy listens with gxStreamServer and accepts only a primary whose certificate chains to the configured CA and has the configured common name. Each frame is one S block; the copy answers each with one S block (the hello reply, or an 8-byte acknowledgment). All numbers are little endian; strings are a 2-byte length and the bytes.

 primary                                   copy
    | -- TLS handshake (certificates both ways) -->|
    | -- hello: magic, epoch, link map, name,      |
    |    role, last seq, running digest ---------->|  checks roles, epoch, history
    |<-- reply: ok, applied seq, epoch, in full    |
    |    send, name, role, applied digest, why ----|
    | -- F_EPOCH epoch --------------------------->|  saves the epoch (fencing)
    |<-- ack: applied seq -------------------------|
    | -- F_COMMIT seq, epoch, ops ---------------->|  applies in one transaction
    |<-- ack: seq ---------------------------------|  after it is durable
    |        ... one commit at a time ...          |

7.2 The full send

When the copy is new, was told to rejoin, or is further behind than the primary's outbox reaches, the primary sends everything instead: F_SNAP_BEGIN (the base sequence), F_SNAP_BATCH frames of objects and tombstones, F_SNAP_DLOG frames with the primary's digest log, and F_SNAP_END with the base's digest, the number of records sent and a hash chained over them. The copy ends the full send only if the count and the hash match what it received; otherwise it waits for the primary to send it again. The copy's old data is set aside, not deleted, until the full send is whole. Commits made while the full send was under way follow from the outbox.

7.3 Failover

Replication is asynchronous: a commit is durable on the primary when Commit() returns, and on the copy once it is acknowledged. If the primary is lost, the commits the copy did not acknowledge are lost with it, and the status shows how many.

7.4 The port

Replication is a gxStream object stream, so it uses the gxStream port. Since 7.4.1 the copy listens on port 2073 and the primary connects to port 2073 unless the configuration names another port (listen [ADDR:]PORT, copy HOST:PORT). In 7.4 the port had no default. A host that runs a copy and another gxStream service on the same address gives one of them another port.

8. Compatibility

9. Security

The design choices that matter for a reviewer of port 2073 (the security white paper has the details):

Limits: a trusted certificate is trusted with everything its service allows (a write client can change any object of its database; a replication peer the copy accepts can raise the copy's epoch or replace its data). The replication digests are FNV-1a hashes that catch mistakes, not forgeries; the mutual TLS check is what keeps forged streams out. Anyone who can reach the port can use up handshake slots for their timeout, so firewall port 2073 to the hosts that need it.