pub struct Socket<A, S> { /* private fields */ }Implementations§
Source§impl<A: NetworkAddress, S> Socket<A, S>
impl<A: NetworkAddress, S> Socket<A, S>
pub fn local_addr(&self) -> A
Sourcepub fn poll_recv(
&self,
buf: &mut [u8],
cx: &mut Context<'_>,
) -> Poll<Result<RecvResult<A>>>
pub fn poll_recv( &self, buf: &mut [u8], cx: &mut Context<'_>, ) -> Poll<Result<RecvResult<A>>>
pub async fn recv(&self, buf: &mut [u8]) -> Result<RecvResult<A>>
Sourcepub fn get_send_timestamp(
&self,
) -> impl Future<Output = Result<(SendTimestampToken, TimestampData)>> + Send + Sync + 'static
pub fn get_send_timestamp( &self, ) -> impl Future<Output = Result<(SendTimestampToken, TimestampData)>> + Send + Sync + 'static
Wait for the next send timestamp to be returned.
Note: There is no poll variant for this function, as that is currently impossible to implement with the tools tokio provides. To compensate, the future returned here is independent of the self reference and can be stored to simulate the existence of a poll function.
Source§impl<A: NetworkAddress> Socket<A, Open>
impl<A: NetworkAddress> Socket<A, Open>
Sourcepub fn poll_send_to(
&self,
buf: &[u8],
addr: A,
cx: &mut Context<'_>,
) -> Poll<Result<Option<SendTimestampToken>>>
pub fn poll_send_to( &self, buf: &[u8], addr: A, cx: &mut Context<'_>, ) -> Poll<Result<Option<SendTimestampToken>>>
Sourcepub async fn send_to(&mut self, buf: &[u8], addr: A) -> Result<TimestampData>
pub async fn send_to(&mut self, buf: &[u8], addr: A) -> Result<TimestampData>
Send a packet to a given receiver on the socket.
When used in combination with the polling send functions, if there are timestamps
pending for some SendTimestampToken, these may be skipped and become unavailable
when calling this function.
Sourcepub fn poll_send_from_to(
&self,
buf: &[u8],
from: A,
to: A,
cx: &mut Context<'_>,
) -> Poll<Result<Option<SendTimestampToken>>>
pub fn poll_send_from_to( &self, buf: &[u8], from: A, to: A, cx: &mut Context<'_>, ) -> Poll<Result<Option<SendTimestampToken>>>
Sourcepub async fn send_from_to(
&mut self,
buf: &[u8],
from: A,
to: A,
) -> Result<TimestampData>
pub async fn send_from_to( &mut self, buf: &[u8], from: A, to: A, ) -> Result<TimestampData>
Send a packet to a given receiver on the socket, using the specified origin address.
When used in combination with the polling send functions, if there are timestamps
pending for some SendTimestampToken, these may be skipped and become unavailable
when calling this function.
pub fn connect(self, addr: A) -> Result<Socket<A, Connected>>
Source§impl<A: NetworkAddress> Socket<A, Connected>
impl<A: NetworkAddress> Socket<A, Connected>
pub fn peer_addr(&self) -> Result<A>
Sourcepub fn poll_send(
&self,
buf: &[u8],
cx: &mut Context<'_>,
) -> Poll<Result<Option<SendTimestampToken>>>
pub fn poll_send( &self, buf: &[u8], cx: &mut Context<'_>, ) -> Poll<Result<Option<SendTimestampToken>>>
Sourcepub async fn send(&mut self, buf: &[u8]) -> Result<TimestampData>
pub async fn send(&mut self, buf: &[u8]) -> Result<TimestampData>
Send a packet on the socket.
When used in combination with the polling send functions, if there are timestamps
pending for some SendTimestampToken, these may be skipped and become unavailable
when calling this function.
Sourcepub fn poll_send_from(
&self,
buf: &[u8],
from: A,
cx: &mut Context<'_>,
) -> Poll<Result<Option<SendTimestampToken>>>
pub fn poll_send_from( &self, buf: &[u8], from: A, cx: &mut Context<'_>, ) -> Poll<Result<Option<SendTimestampToken>>>
Sourcepub async fn send_from(&mut self, buf: &[u8], from: A) -> Result<TimestampData>
pub async fn send_from(&mut self, buf: &[u8], from: A) -> Result<TimestampData>
Send a packet on the socket, with the given local address.
When used in combination with the polling send functions, if there are timestamps
pending for some SendTimestampToken, these may be skipped and become unavailable
when calling this function.