Skip to content

Commit 67dfe8b

Browse files
committed
added comparison operator to WiFiUdp class
1 parent eb15ce1 commit 67dfe8b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

libraries/WiFiS3/src/WiFiUdp.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,12 @@ void WiFiUDP::flush() {
249249
modem.write(string(PROMPT(_UDPFLUSH)),res, "%s%d\r\n" , CMD_WRITE(_UDPFLUSH), _sock);
250250
}
251251
}
252-
252+
253+
bool WiFiUDP::operator==(const WiFiUDP& whs)
254+
{
255+
return _sock == whs._sock;
256+
}
257+
253258
/* -------------------------------------------------------------------------- */
254259
IPAddress WiFiUDP::remoteIP() {
255260
/* -------------------------------------------------------------------------- */

libraries/WiFiS3/src/WiFiUdp.h

+5
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ class WiFiUDP : public UDP {
8282
// Return the next byte from the current packet without moving on to the next byte
8383
virtual int peek();
8484
virtual void flush(); // Finish reading the current packet
85+
virtual bool operator==(const WiFiUDP&);
86+
virtual bool operator!=(const WiFiUDP& whs)
87+
{
88+
return !this->operator==(whs);
89+
};
8590

8691
// Return the IP address of the host who sent the current incoming packet
8792
virtual IPAddress remoteIP();

0 commit comments

Comments
 (0)