Struct ublox_cellular::sockets::TcpSocket [−][src]
Expand description
A Transmission Control Protocol socket.
A TCP socket may passively listen for connections or actively connect to another endpoint. Note that, for listening sockets, there is no “backlog”; to be able to simultaneously accept several connections, as many sockets must be allocated, or any new connection attempts will be reset.
Implementations
Return the socket handle.
Return the connection state, in terms of the TCP state machine.
pub fn should_update_available_data(&mut self, ts: Instant<CLK>) -> bool where
Generic<CLK::T>: TryInto<Milliseconds>,
pub fn closed_by_remote(&mut self, ts: Instant<CLK>) where
Generic<CLK::T>: TryInto<Milliseconds>,
Set available data.
Get the number of bytes available to ingress.
Return whether a connection is active.
This function returns true if the socket is actively exchanging packets with a remote endpoint. Note that this does not mean that it is possible to send or receive data through the socket; for that, use can_recv.
Return whether the receive half of the full-duplex connection is open.
This function returns true if it’s possible to receive data from the remote endpoint. It will return true while there is data in the receive buffer, and if there isn’t, as long as the remote endpoint has not closed the connection.
In terms of the TCP state machine, the socket must be in the Connected
,
FIN-WAIT-1
, or FIN-WAIT-2
state, or have data in the receive buffer instead.
Check whether the receive half of the full-duplex connection buffer is open (see may_recv, and the receive buffer is not full.
Call f
with the largest contiguous slice of octets in the receive buffer,
and dequeue the amount of elements returned by f
.
This function returns `Err(Error::Illegal) if the receive half of the connection is not open; see may_recv.
Call f
with a slice of octets in the receive buffer, and dequeue the
amount of elements returned by f
.
If the buffer read wraps around, the second argument of f
will be
Some()
with the remainder of the buffer, such that the combined slice
of the two arguments, makes up the full buffer.
This function returns `Err(Error::Illegal) if the receive half of the connection is not open; see may_recv.
Dequeue a sequence of received octets, and fill a slice from it.
This function returns the amount of bytes actually dequeued, which is limited by the amount of free space in the transmit buffer; down to zero.
See also recv.
Peek at a sequence of received octets without removing them from the receive buffer, and return a pointer to it.
This function otherwise behaves identically to recv.
Peek at a sequence of received octets without removing them from the receive buffer, and fill a slice from it.
This function otherwise behaves identically to recv_slice.
Return the amount of octets queued in the receive buffer.
Note that the Berkeley sockets interface does not have an equivalent of this API.