Function sntpc::sntp_send_request

source ·
pub fn sntp_send_request<A, U, T>(
    dest: A,
    socket: &U,
    context: NtpContext<T>
) -> Result<SendRequestResult>
Expand description

Send SNTP request to a server

That function along with the sntp_process_response is required under an environment(s) where you need to call TCP/IP stack helpers (like poll, wait, etc.) Args:

  • dest - Initial NTP server’s address to validate response against
  • socket - Socket reference to use for receiving a NTP response
  • context - SNTP client context

Example

use sntpc::{self, NtpContext, NtpTimestampGenerator, Result};
// implement required trait on network objects

// implement required trait on the timestamp generator object
// "time.google.com:123" string here used for the sake of simplicity. In the real app
// you would want to fix destination address, since string hostname may resolve to
// different IP addresses
let result = sntpc::sntp_send_request("time.google.com:123", &socket, ntp_context);