Skip to content

Commit 9e4323b

Browse files
author
Luigi Gubello
committed
Adding range choice for setRandomPort()
1 parent a8bdae7 commit 9e4323b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

NTPClient.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ void NTPClient::sendNTPPacket() {
204204
this->_udp->endPacket();
205205
}
206206

207-
void NTPClient::setRandomPort() {
207+
void NTPClient::setRandomPort(long minValue, long maxValue) {
208208
randomSeed(analogRead(0));
209-
this->_port = random(1, 65534);
209+
this->_port = random(minValue, maxValue);
210210
}

NTPClient.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class NTPClient {
4747
/**
4848
* Set random local port
4949
*/
50-
void setRandomPort();
50+
void setRandomPort(long minValue, long maxValue);
5151

5252
/**
5353
* Starts the underlying UDP client with the default local port

0 commit comments

Comments
 (0)