mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2026-06-10 09:54:47 -04:00
Network interface selection for outgoing UDP multicast datagrams
Default selection is the loop-back interface. Users who require interoperation between WSJT-X instances cooperating applications running on different hosts should select a suitable network interface and carefully choose a multicast group address, and TTL, that has minimal scope covering the necessary network(s). Using 224.0.0.1 is a reasonable strategy if all hosts are on the same subnet. Administratively scoped multicast group addresses like those within 239.255.0.0/16 can cover larger boundaries, but care must be taken if the local subnet has access to a multicast enabled router. The IPv4 broadcast address (255.255.255.255) may be used as an alternative to multicast UDP, but note that WSJT-X will only send broadcast UDP datagrams on the loop-back interface, so all recipient applications must be running on the same host system. The reference UDP Message protocol applications are being extended to be configurable with a list of interfaces to join a multicast group address on. By default they will only join on the loop-back interface, which is also recommended for any applications designed to take part in the WSJT-X UDP Message Protocol. This allows full user control of the scope of multicast group membership with a very conservative default mode that will work with all interoperating applications running on the same host system.
This commit is contained in:
@@ -20,6 +20,9 @@
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QCommandLineParser>
|
||||
#include <QCommandLineOption>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QDateTime>
|
||||
#include <QTime>
|
||||
#include <QHash>
|
||||
@@ -144,7 +147,7 @@ class Server
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Server (port_type port, QHostAddress const& multicast_group)
|
||||
Server (port_type port, QHostAddress const& multicast_group, QStringList const& network_interface_names)
|
||||
: server_ {new MessageServer {this}}
|
||||
{
|
||||
// connect up server
|
||||
@@ -154,7 +157,7 @@ public:
|
||||
connect (server_, &MessageServer::client_opened, this, &Server::add_client);
|
||||
connect (server_, &MessageServer::client_closed, this, &Server::remove_client);
|
||||
|
||||
server_->start (port, multicast_group);
|
||||
server_->start (port, multicast_group, network_interface_names);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -232,9 +235,19 @@ int main (int argc, char * argv[])
|
||||
app.translate ("UDPDaemon", "GROUP"));
|
||||
parser.addOption (multicast_addr_option);
|
||||
|
||||
QCommandLineOption network_interface_option (QStringList {"i", "network-interface"},
|
||||
app.translate ("UDPDaemon",
|
||||
"Where <INTERFACE> is the network interface name to join on.\n"
|
||||
"This option can be passed more than once to specify multiple network interfaces\n"
|
||||
"The default is use just the loop back interface."),
|
||||
app.translate ("UDPDaemon", "INTERFACE"));
|
||||
parser.addOption (network_interface_option);
|
||||
|
||||
parser.process (app);
|
||||
|
||||
Server server {static_cast<port_type> (parser.value (port_option).toUInt ()), QHostAddress {parser.value (multicast_addr_option)}};
|
||||
Server server {static_cast<port_type> (parser.value (port_option).toUInt ())
|
||||
, QHostAddress {parser.value (multicast_addr_option).trimmed ()}
|
||||
, parser.values (network_interface_option)};
|
||||
|
||||
return app.exec ();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user