Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: coap-example Borsch coap-example
Fork of NetworkServices by
SNTPClient Class Reference
SNTPClient client Class. More...
#include <SNTPClient.h>
Public Member Functions | |
| SNTPClient (NetworkStack *ns, const char *url, uint8_t time_zone) | |
| Constructor. | |
| bool | connect () |
| Connect to the SNTPClient url. | |
| bool | getTime (datetime *time) |
| Read a SNTPClient message. | |
| bool | close () |
| Close the SNTPClient connection. | |
Detailed Description
SNTPClient client Class.
Example (ethernet network):
#include "mbed.h" #include "EthernetInterface.h" #include "SNTPClient.h" int main() { EthernetInterface eth; eth.init(); //Use DHCP eth.connect(); printf("IP Address is %s\n\r", eth.getIPAddress()); SNTPClient ws("ws://sockets.mbed.org:443/ws/demo/rw"); ws.connect(); while (1) { int res = ws.send("SNTPClient Hello World!"); if (ws.read(recv)) { printf("rcv: %s\r\n", recv); } wait(0.1); } }
Definition at line 113 of file SNTPClient.h.
Constructor & Destructor Documentation
| SNTPClient | ( | NetworkStack * | ns, |
| const char * | url, | ||
| uint8_t | time_zone | ||
| ) |
Member Function Documentation
| bool close | ( | ) |
Close the SNTPClient connection.
- Returns:
- true if the connection has been closed, false otherwise
Definition at line 105 of file SNTPClient.cpp.
| bool connect | ( | ) |
Connect to the SNTPClient url.
- Returns:
- true if the connection is established, false otherwise
Definition at line 38 of file SNTPClient.cpp.
| bool getTime | ( | datetime * | time ) |
Read a SNTPClient message.
- Parameters:
-
message pointer to the string to be read (null if drop frame)
- Returns:
- true if a SNTPClient frame has been read
Definition at line 79 of file SNTPClient.cpp.
Generated on Fri Jul 15 2022 01:11:08 by
1.7.2
