Skip to content

Support TCP for protocol messages#3636

Draft
softins wants to merge 18 commits intojamulussoftware:mainfrom
softins:tcp-protocol
Draft

Support TCP for protocol messages#3636
softins wants to merge 18 commits intojamulussoftware:mainfrom
softins:tcp-protocol

Conversation

@softins
Copy link
Copy Markdown
Member

@softins softins commented Mar 11, 2026

Short description of changes

Support fallback to TCP for protocol messages, in order to overcome potential loss of large messages due to UDP fragmentation. Currently an incomplete draft, for comment as development continues.

CHANGELOG: Client/Server: Support TCP fallback for protocol messages.

Context: Fixes an issue?

Discussed in issue #3242.

Does this change need documentation? What needs to be documented and how?

It will need documentation once design and development are complete. Particularly need to explain the firewall requirements for a server or directory.

Status of this Pull Request

Incomplete, still under development. Main server side complete and working. Client side not written yet development in progress.

What is missing until this pull request can be merged?

Completion and a lot of testing of both server and client. Intended for Jamulus 4.0.0.

Checklist

  • I've verified that this Pull Request follows the general code principles
  • I tested my code and it does what I want
  • My code follows the style guide
  • I waited some time after this Pull Request was opened and all GitHub checks completed without errors.
  • I've filled all the content above

@softins softins added this to the Release 4.0.0 milestone Mar 11, 2026
@softins softins self-assigned this Mar 11, 2026
@softins
Copy link
Copy Markdown
Member Author

softins commented Mar 11, 2026

So far, this implements the server side of the design described here and here

@softins softins force-pushed the tcp-protocol branch 3 times, most recently from f6e95f8 to 5e1a658 Compare March 14, 2026 17:06
@softins softins linked an issue Mar 16, 2026 that may be closed by this pull request
@softins softins added the feature request Feature request label Mar 16, 2026
@softins softins force-pushed the tcp-protocol branch 2 times, most recently from a61321d to 7ad1d1f Compare March 25, 2026 20:38
@softins
Copy link
Copy Markdown
Member Author

softins commented Mar 28, 2026

So the next stage of implementation has been achieved: client-side support in the Connect dialog.

  1. If the server list has not been received via UDP when the associated message indicating TCP support has arrived, the client will retry fetching the server list over TCP.
  2. If the client list for a server has not been received via UDP when the associated message indicating TCP support has arrived, the client will retry fetching the client list over TCP, and will continue to use TCP for that server while the Connect dialog is open.
  3. A directory or server that does not have TCP support will not send the TCP supported message, and will continue to be handled as in current versions.
  4. If the server list or client list is successfully received over UDP, there is no need for the client to try TCP.

It has been tested by using nft to drop outbound Jamulus UDP messages with a specific message ID, to simulate loss due to fragmentation.

Examples for a directory-enabled server running on port 22120:

  • drop UDP server list: nft add rule inet filter output udp sport 22120 @ih,16,16 0xee03 drop
  • drop UDP client list: nft add rule inet filter output udp sport 22120 @ih,16,16 0xf503 drop
  • drop UDP "TCP supported" msg: nft add rule inet filter output udp sport 22120 @ih,16,16 0xfb03 drop

Note that nft rules require network byte order (big-endian), but Jamulus IDs are little-endian:

  • CLM_SERVER_LIST = 1006 = 0x03ee => 0xee03 (LE byte order)
  • CLM_RED_SERVER_LIST = 1018 = 0x03fa => 0xfa03 (LE byte order)
  • CLM_CONN_CLIENTS_LIST = 1013 = 0x03f5 => 0xf503 (LE byte order)
  • CLM_TCP_SUPPORTED = 1019 = 0x03fb => 0xfb03 (LE byte order)

@softins
Copy link
Copy Markdown
Member Author

softins commented Mar 28, 2026

The next step is to try implementing the connected-mode TCP described here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request Feature request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support TCP for protocol messages

1 participant