notes.dt.in.th

UDP hole punching in Jamulus

While developing a Go implementation of Jamulus protocol client, I ran into an issue where my client cannot connect to a the server, whereas the normal Jamulus client can.

Turns out this is due to many Jamulus servers are behind a firewall. They don’t accept UDP packets from strangers.

It turns out that the Directory Server faciliates the connection by using the UDP hole punching technique.

The hole punching logic is in CServerListManager::RetrieveAll, which gets called on CServer::OnCLReqServerList, which gets triggered on the CProtocol::CLReqServerList event, handled via the PROTMESSID_CLM_REQ_SERVER_LIST (1007) protocol message.