From 5dc2e7b0ca1354b54f50e6db6db99acad67003ac Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Sat, 1 Feb 2025 20:12:24 +0100 Subject: [PATCH] do'nt use random local ports --- Participant.cpp | 8 ++++---- UdpArduino.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Participant.cpp b/Participant.cpp index 3699e9f..1beed96 100644 --- a/Participant.cpp +++ b/Participant.cpp @@ -30,8 +30,8 @@ Participant::Participant(int port) { this->participants.push_back(this); - int randomPort = (rand() % (65535 - 49152 + 1)) + 49152; - this->localPort = randomPort; + // int randomPort = (rand() % (65535 - 49152 + 1)) + 49152; + this->localPort = port; // SetupUDP(randomPort, ipAddress, port); } @@ -41,8 +41,8 @@ Participant::Participant(const char *ipAddress, int port) { this->participants.push_back(this); - int randomPort = (rand() % (65535 - 49152 + 1)) + 49152; - this->localPort = randomPort; + // int randomPort = (rand() % (65535 - 49152 + 1)) + 49152; + this->localPort = port; // randomPort; // SetupUDP(randomPort, ipAddress, port); } diff --git a/UdpArduino.cpp b/UdpArduino.cpp index 40184af..31d81ff 100644 --- a/UdpArduino.cpp +++ b/UdpArduino.cpp @@ -17,7 +17,7 @@ void UdpArduino::Setup(int localPort, const char *remoteIpAddress, std::cout << "No network available!\n"; return; } - udp.begin(this->remotePort); + udp.begin(this->localPort); std::cout << "Wifi sync started to port " << this->remotePort << "\n"; #endif