Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions wiring/inc/spark_wiring_udp.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,13 @@ class UDP : public Stream, public Printable {
* @return Return the result of the leave operation
*/
int leaveMulticast(const IPAddress& ip);

/*
* let client code to check for socket validity
* @return True for a valid socket.
*/
bool isValid();


using Print::write;
};
Expand Down
5 changes: 5 additions & 0 deletions wiring/src/spark_wiring_udp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,8 @@ int UDP::leaveMulticast(const IPAddress& ip)
HAL_IPAddress address = ip.raw();
return socket_leave_multicast(&address, _nif, 0);
}

bool UDP::isValid()
{
return _sock != socket_handle_invalid();
}