Struct zircon_object::ipc::Socket [−][src]
Bidirectional streaming IPC transport.
SYNOPSIS
Sockets are a bidirectional stream transport. Unlike channels, sockets only move data (not handles).
Implementations
impl Socket
[src]
pub fn create(flags: u32) -> ZxResult<(Arc<Self>, Arc<Self>)>
[src]
Create a socket.
pub fn write(&self, data: &[u8]) -> ZxResult<usize>
[src]
Write data to the socket. If successful, the number of bytes actually written are returned.
A SOCKET_STREAM(default) socket write can be short if the socket does not have enough space for all of data. Otherwise, if the socket was already full, the call returns ZxError::SHOULD_WAIT.
A SOCKET_DATAGRAM socket write is never short. If the socket has insufficient space for data, it writes nothing and returns ZxError::SHOULD_WAIT. Attempting to write a packet larger than the datagram socket’s capacity will fail with ZxError::OUT_OF_RANGE.
pub fn read(&self, peek: bool, data: &mut [u8]) -> ZxResult<usize>
[src]
Read data from the socket. If successful, the number of bytes actually read are returned.
If the socket was created with SOCKET_DATAGRAM, this method reads only the first available datagram in the socket (if one is present). If data is too small for the datagram, then the read will be truncated, and any remaining bytes in the datagram will be discarded.
If peek
is true, leave the message in the socket. Otherwise consume the message.
pub fn get_info(&self) -> SocketInfo
[src]
Get information of the socket.
pub fn shutdown(&self, read: bool, write: bool) -> ZxResult
[src]
Prevent reading or writing.
pub fn set_read_threshold(&self, threshold: usize) -> ZxResult
[src]
Set the read threshold of the socket.
When the bytes queued on the socket (available for reading) is equal to or greater than this value, the SOCKET_READ_THRESHOLD signal is asserted. Read threshold signalling is disabled by default (and when set, writing a value of 0 for this property disables it).
pub fn set_write_threshold(&self, threshold: usize) -> ZxResult
[src]
Set the write threshold of the socket.
When the space available for writing on the socket is equal to or greater than this value, the SOCKET_WRITE_THRESHOLD signal is asserted. Write threshold signalling is disabled by default (and when set, writing a value of 0 for this property disables it).
pub fn get_rx_tx_threshold(&self) -> (usize, usize)
[src]
Get the read and write thresholds of the socket.
Trait Implementations
impl Debug for Socket
[src]
impl Drop for Socket
[src]
impl KernelObject for Socket
[src]
fn id(&self) -> KoID
[src]
fn type_name(&self) -> &str
[src]
fn name(&self) -> String
[src]
fn set_name(&self, name: &str)
[src]
fn signal(&self) -> Signal
[src]
fn signal_set(&self, signal: Signal)
[src]
fn signal_clear(&self, signal: Signal)
[src]
fn signal_change(&self, clear: Signal, set: Signal)
[src]
fn add_signal_callback(&self, callback: SignalHandler)
[src]
fn peer(&self) -> ZxResult<Arc<dyn KernelObject>>
[src]
fn related_koid(&self) -> KoID
[src]
fn get_child(&self, _id: KoID) -> ZxResult<Arc<dyn KernelObject>>
[src]
fn allowed_signals(&self) -> Signal
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Socket
impl Send for Socket
impl Sync for Socket
impl Unpin for Socket
impl !UnwindSafe for Socket
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Downcast for T where
T: Any,
[src]
T: Any,
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
[src]
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
[src]
pub fn as_any(&self) -> &(dyn Any + 'static)
[src]
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
[src]
impl<T> DowncastSync for T where
T: Send + Sync + Any,
[src]
T: Send + Sync + Any,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,