MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / applyUdpRemote

Function applyUdpRemote

app/src/Misc/CLI.cpp:518–535  ·  view source on GitHub ↗

* @brief Applies the optional --udp-remote spec to the active network driver. */

Source from the content-addressed store, hash-verified

516 * @brief Applies the optional --udp-remote spec to the active network driver.
517 */
518static void applyUdpRemote(const QString& udpRemote)
519{
520 const QStringList parts = udpRemote.split(':');
521 if (parts.size() != 2) {
522 qWarning() << "Invalid UDP address format. Expected: host:port";
523 return;
524 }
525
526 bool ok = false;
527 const quint16 remotePort = parts[1].toUInt(&ok);
528 if (!ok || remotePort == 0) {
529 qWarning() << "Invalid UDP remote port:" << parts[1];
530 return;
531 }
532
533 IO::ConnectionManager::instance().network()->setRemoteAddress(parts[0]);
534 IO::ConnectionManager::instance().network()->setUdpRemotePort(remotePort);
535}
536
537/**
538 * @brief Configures and connects a UDP socket from CLI options.

Callers 1

setupUdpConnectionMethod · 0.85

Calls 4

networkMethod · 0.80
sizeMethod · 0.45
setRemoteAddressMethod · 0.45
setUdpRemotePortMethod · 0.45

Tested by

no test coverage detected