Struct cap_std::net::UdpSocket [−][src]
pub struct UdpSocket { /* fields omitted */ }
A UDP socket.
This corresponds to std::net::UdpSocket
.
Note that this UdpSocket
has no bind
, connect
, or send_to
methods. To
create a UdpSocket
bound to an address or to send a message to an address,
you must first obtain a Catalog
permitting the address, and then call
Catalog::bind_udp_socket
, or Catalog::connect_udp_socket
, or
Catalog::send_to_udp_socket_addr
.
Implementations
impl UdpSocket
[src]
impl UdpSocket
[src]pub unsafe fn from_std(std: UdpSocket) -> Self
[src]
pub unsafe fn from_std(std: UdpSocket) -> Self
[src]Constructs a new instance of Self
from the given std::net::UdpSocket
.
Safety
std::net::UdpSocket
is not sandboxed and may access any address that the host
process has access to.
pub fn recv_from(&self, buf: &mut [u8]) -> Result<(usize, SocketAddr)>
[src]
pub fn recv_from(&self, buf: &mut [u8]) -> Result<(usize, SocketAddr)>
[src]Receives a single datagram message on the socket.
This corresponds to std::net::UdpSocket::recv_from
.
pub fn peek_from(&self, buf: &mut [u8]) -> Result<(usize, SocketAddr)>
[src]
pub fn peek_from(&self, buf: &mut [u8]) -> Result<(usize, SocketAddr)>
[src]Receives a single datagram message on the socket, without removing it from the queue.
This corresponds to std::net::UdpSocket::peek_from
.
pub fn peer_addr(&self) -> Result<SocketAddr>
[src]
pub fn peer_addr(&self) -> Result<SocketAddr>
[src]Returns the socket address of the remote peer this socket was connected to.
This corresponds to std::net::UdpSocket::peer_addr
.
pub fn local_addr(&self) -> Result<SocketAddr>
[src]
pub fn local_addr(&self) -> Result<SocketAddr>
[src]Returns the socket address that this socket was created from.
This corresponds to std::net::UdpSocket::local_addr
.
pub fn try_clone(&self) -> Result<Self>
[src]
pub fn try_clone(&self) -> Result<Self>
[src]Creates a new independently owned handle to the underlying socket.
This corresponds to std::net::UdpSocket::try_clone
.
pub fn set_read_timeout(&self, dur: Option<Duration>) -> Result<()>
[src]
pub fn set_read_timeout(&self, dur: Option<Duration>) -> Result<()>
[src]Sets the read timeout to the timeout specified.
This corresponds to std::net::UdpSocket::set_read_timeout
.
pub fn set_write_timeout(&self, dur: Option<Duration>) -> Result<()>
[src]
pub fn set_write_timeout(&self, dur: Option<Duration>) -> Result<()>
[src]Sets the write timeout to the timeout specified.
This corresponds to std::net::UdpSocket::set_write_timeout
.
pub fn read_timeout(&self) -> Result<Option<Duration>>
[src]
pub fn read_timeout(&self) -> Result<Option<Duration>>
[src]Returns the read timeout of this socket.
This corresponds to std::net::UdpSocket::read_timeout
.
pub fn write_timeout(&self) -> Result<Option<Duration>>
[src]
pub fn write_timeout(&self) -> Result<Option<Duration>>
[src]Returns the write timeout of this socket.
This corresponds to std::net::UdpSocket::write_timeout
.
pub fn set_broadcast(&self, broadcast: bool) -> Result<()>
[src]
pub fn set_broadcast(&self, broadcast: bool) -> Result<()>
[src]Sets the value of the SO_BROADCAST
option for this socket.
This corresponds to std::net::UdpSocket::set_broadcast
.
pub fn broadcast(&self) -> Result<bool>
[src]
pub fn broadcast(&self) -> Result<bool>
[src]Gets the value of the SO_BROADCAST
option for this socket.
This corresponds to std::net::UdpSocket::broadcast
.
pub fn set_multicast_loop_v4(&self, multicast_loop_v4: bool) -> Result<()>
[src]
pub fn set_multicast_loop_v4(&self, multicast_loop_v4: bool) -> Result<()>
[src]Sets the value of the IP_MULTICAST_LOOP
option for this socket.
This corresponds to std::net::UdpSocket::set_multicast_loop_v4
.
pub fn multicast_loop_v4(&self) -> Result<bool>
[src]
pub fn multicast_loop_v4(&self) -> Result<bool>
[src]Gets the value of the IP_MULTICAST_LOOP
option for this socket.
This corresponds to std::net::UdpSocket::multicast_loop_v4
.
pub fn set_multicast_ttl_v4(&self, multicast_ttl_v4: u32) -> Result<()>
[src]
pub fn set_multicast_ttl_v4(&self, multicast_ttl_v4: u32) -> Result<()>
[src]Sets the value of the IP_MULTICAST_TTL
option for this socket.
This corresponds to std::net::UdpSocket::set_multicast_ttl_v4
.
pub fn multicast_ttl_v4(&self) -> Result<u32>
[src]
pub fn multicast_ttl_v4(&self) -> Result<u32>
[src]Gets the value of the IP_MULTICAST_TTL
option for this socket.
This corresponds to std::net::UdpSocket::multicast_ttl_v4
.
pub fn set_multicast_loop_v6(&self, multicast_loop_v6: bool) -> Result<()>
[src]
pub fn set_multicast_loop_v6(&self, multicast_loop_v6: bool) -> Result<()>
[src]Sets the value of the IPV6_MULTICAST_LOOP
option for this socket.
This corresponds to std::net::UdpSocket::set_multicast_loop_v6
.
pub fn multicast_loop_v6(&self) -> Result<bool>
[src]
pub fn multicast_loop_v6(&self) -> Result<bool>
[src]Gets the value of the IPV6_MULTICAST_LOOP
option for this socket.
This corresponds to std::net::UdpSocket::multicast_loop_v6
.
pub fn set_ttl(&self, ttl: u32) -> Result<()>
[src]
pub fn set_ttl(&self, ttl: u32) -> Result<()>
[src]Sets the value for the IP_TTL
option on this socket.
This corresponds to std::net::UdpSocket::set_ttl
.
pub fn ttl(&self) -> Result<u32>
[src]
pub fn ttl(&self) -> Result<u32>
[src]Gets the value of the IP_TTL
option for this socket.
This corresponds to std::net::UdpSocket::ttl
.
pub fn join_multicast_v4(
&self,
multiaddr: &Ipv4Addr,
interface: &Ipv4Addr
) -> Result<()>
[src]
pub fn join_multicast_v4(
&self,
multiaddr: &Ipv4Addr,
interface: &Ipv4Addr
) -> Result<()>
[src]Executes an operation of the IP_ADD_MEMBERSHIP
type.
This corresponds to std::net::UdpSocket::join_multicast_v4
.
pub fn join_multicast_v6(
&self,
multiaddr: &Ipv6Addr,
interface: u32
) -> Result<()>
[src]
pub fn join_multicast_v6(
&self,
multiaddr: &Ipv6Addr,
interface: u32
) -> Result<()>
[src]Executes an operation of the IPV6_ADD_MEMBERSHIP
type.
This corresponds to std::net::UdpSocket::join_multicast_v6
.
pub fn leave_multicast_v4(
&self,
multiaddr: &Ipv4Addr,
interface: &Ipv4Addr
) -> Result<()>
[src]
pub fn leave_multicast_v4(
&self,
multiaddr: &Ipv4Addr,
interface: &Ipv4Addr
) -> Result<()>
[src]Executes an operation of the IP_DROP_MEMBERSHIP
type.
This corresponds to std::net::UdpSocket::leave_multicast_v4
.
pub fn leave_multicast_v6(
&self,
multiaddr: &Ipv6Addr,
interface: u32
) -> Result<()>
[src]
pub fn leave_multicast_v6(
&self,
multiaddr: &Ipv6Addr,
interface: u32
) -> Result<()>
[src]Executes an operation of the IPV6_DROP_MEMBERSHIP
type.
This corresponds to std::net::UdpSocket::leave_multicast_v6
.
pub fn take_error(&self) -> Result<Option<Error>>
[src]
pub fn take_error(&self) -> Result<Option<Error>>
[src]Gets the value of the SO_ERROR
option on this socket.
This corresponds to std::net::UdpSocket::take_error
.
pub fn send(&self, buf: &[u8]) -> Result<usize>
[src]
pub fn send(&self, buf: &[u8]) -> Result<usize>
[src]Sends data on the socket to the remote address to which it is connected.
This corresponds to std::net::UdpSocket::send
.
pub fn recv(&self, buf: &mut [u8]) -> Result<usize>
[src]
pub fn recv(&self, buf: &mut [u8]) -> Result<usize>
[src]Receives a single datagram message on the socket from the remote address to which it is connected.
This corresponds to std::net::UdpSocket::recv
.
pub fn peek(&self, buf: &mut [u8]) -> Result<usize>
[src]
pub fn peek(&self, buf: &mut [u8]) -> Result<usize>
[src]Receives single datagram on the socket from the remote address to which it is connected, without removing the message from input queue.
This corresponds to std::net::UdpSocket::peek
.
pub fn set_nonblocking(&self, nonblocking: bool) -> Result<()>
[src]
pub fn set_nonblocking(&self, nonblocking: bool) -> Result<()>
[src]Moves this UDP socket into or out of nonblocking mode.
This corresponds to std::net::UdpSocket::set_nonblocking
.
Trait Implementations
impl FromRawFd for UdpSocket
[src]
impl FromRawFd for UdpSocket
[src]unsafe fn from_raw_fd(fd: RawFd) -> Self
[src]
unsafe fn from_raw_fd(fd: RawFd) -> Self
[src]Constructs a new instance of Self
from the given raw file
descriptor. Read more
impl IntoRawFd for UdpSocket
[src]
impl IntoRawFd for UdpSocket
[src]fn into_raw_fd(self) -> RawFd
[src]
fn into_raw_fd(self) -> RawFd
[src]Consumes this object, returning the raw underlying file descriptor. Read more
impl OwnsRaw for UdpSocket
[src]
Auto Trait Implementations
impl RefUnwindSafe for UdpSocket
impl Send for UdpSocket
impl Sync for UdpSocket
impl Unpin for UdpSocket
impl UnwindSafe for UdpSocket
Blanket Implementations
impl<T> AsUnsafeFile for T where
T: AsRawFd + OwnsRaw,
[src]
impl<T> AsUnsafeFile for T where
T: AsRawFd + OwnsRaw,
[src]pub fn as_unsafe_file(&self) -> UnsafeFile
[src]
pub fn as_unsafe_file(&self) -> UnsafeFile
[src]Return the contained unsafe file.
fn as_file_view(&self) -> View<'_, File>
[src]
fn as_file_view(&self) -> View<'_, File>
[src]Utility for returning a value which dereferences to a &File
or
&mut File
. Read more
unsafe fn as_unscoped_file_view(&self) -> View<'static, File>
[src]
unsafe fn as_unscoped_file_view(&self) -> View<'static, File>
[src]Like as_file_view
, but returns a value which is not explicitly tied
to the lifetime of self
. Read more
impl<T> AsUnsafeHandle for T where
T: AsRawFd + OwnsRaw,
[src]
impl<T> AsUnsafeHandle for T where
T: AsRawFd + OwnsRaw,
[src]pub fn as_unsafe_handle(&self) -> UnsafeHandle
[src]
pub fn as_unsafe_handle(&self) -> UnsafeHandle
[src]Return the contained unsafe handle.
impl<T> AsUnsafeSocket for T where
T: AsRawFd + OwnsRaw,
[src]
impl<T> AsUnsafeSocket for T where
T: AsRawFd + OwnsRaw,
[src]pub fn as_unsafe_socket(&self) -> UnsafeSocket
[src]
pub fn as_unsafe_socket(&self) -> UnsafeSocket
[src]Return the contained unsafe socket.
fn as_tcp_stream_view(&self) -> View<'_, TcpStream>
[src]
fn as_tcp_stream_view(&self) -> View<'_, TcpStream>
[src]Utility for returning a value which dereferences to a &TcpStream
or
&mut TcpStream
. Read more
unsafe fn as_unscoped_tcp_stream_view(&self) -> View<'static, TcpStream>
[src]
unsafe fn as_unscoped_tcp_stream_view(&self) -> View<'static, TcpStream>
[src]Like as_tcp_stream_view
, but returns a value which is not explicitly
tied to the lifetime of self
. Read more
fn as_tcp_listener_view(&self) -> View<'_, TcpListener>
[src]
fn as_tcp_listener_view(&self) -> View<'_, TcpListener>
[src]Utility for returning a value which dereferences to a &TcpListener
or
&mut TcpListener
. Read more
unsafe fn as_unscoped_tcp_listener_view(&self) -> View<'static, TcpListener>
[src]
unsafe fn as_unscoped_tcp_listener_view(&self) -> View<'static, TcpListener>
[src]Like as_tcp_listener_view
, but returns a value which is not
explicitly tied to the lifetime of self
. Read more
fn as_udp_socket_view(&self) -> View<'_, UdpSocket>
[src]
fn as_udp_socket_view(&self) -> View<'_, UdpSocket>
[src]Utility for returning a value which dereferences to a &UdpSocket
or
&mut UdpSocket
. Read more
unsafe fn as_unscoped_udp_socket_view(&self) -> View<'static, UdpSocket>
[src]
unsafe fn as_unscoped_udp_socket_view(&self) -> View<'static, UdpSocket>
[src]Like as_udp_socket_view
, but returns a value which is not explicitly
tied to the lifetime of self
. Read more
fn as_unix_stream_view(&self) -> View<'_, UnixStream>
[src]
fn as_unix_stream_view(&self) -> View<'_, UnixStream>
[src]Utility for returning a value which dereferences to a &UnixStream
or
&mut UnixStream
. Read more
unsafe fn as_unscoped_unix_stream_view(&self) -> View<'static, UnixStream>
[src]
unsafe fn as_unscoped_unix_stream_view(&self) -> View<'static, UnixStream>
[src]Like as_unix_stream_view
, but returns a value which is not explicitly
tied to the lifetime of self
. Read more
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> FromUnsafeFile for T where
T: FromRawFd + OwnsRaw,
[src]
impl<T> FromUnsafeFile for T where
T: FromRawFd + OwnsRaw,
[src]pub unsafe fn from_unsafe_file(unsafe_file: UnsafeFile) -> T
[src]
pub unsafe fn from_unsafe_file(unsafe_file: UnsafeFile) -> T
[src]Convert an unsafe file into a Self
. Read more
fn from_filelike<Filelike>(filelike: Filelike) -> Self where
Filelike: IntoUnsafeFile,
[src]
fn from_filelike<Filelike>(filelike: Filelike) -> Self where
Filelike: IntoUnsafeFile,
[src]Convert from a type which implements IntoUnsafeFile
into a type that
implements FromUnsafeFile
. Read more
impl<T> FromUnsafeSocket for T where
T: FromRawFd + OwnsRaw,
[src]
impl<T> FromUnsafeSocket for T where
T: FromRawFd + OwnsRaw,
[src]pub unsafe fn from_unsafe_socket(unsafe_socket: UnsafeSocket) -> T
[src]
pub unsafe fn from_unsafe_socket(unsafe_socket: UnsafeSocket) -> T
[src]Convert an unsafe socket into a Self
. Read more
fn from_socketlike<Socketlike>(socketlike: Socketlike) -> Self where
Socketlike: IntoUnsafeSocket,
[src]
fn from_socketlike<Socketlike>(socketlike: Socketlike) -> Self where
Socketlike: IntoUnsafeSocket,
[src]Convert from a type which implements IntoUnsafeSocket
into a type
that implements FromUnsafeSocket
. Read more
impl<T> IntoUnsafeFile for T where
T: IntoRawFd + OwnsRaw,
[src]
impl<T> IntoUnsafeFile for T where
T: IntoRawFd + OwnsRaw,
[src]pub fn into_unsafe_file(self) -> UnsafeFile
[src]
pub fn into_unsafe_file(self) -> UnsafeFile
[src]Convert self
into an unsafe file.
impl<T> IntoUnsafeHandle for T where
T: IntoRawFd + OwnsRaw,
[src]
impl<T> IntoUnsafeHandle for T where
T: IntoRawFd + OwnsRaw,
[src]pub fn into_unsafe_handle(self) -> UnsafeHandle
[src]
pub fn into_unsafe_handle(self) -> UnsafeHandle
[src]Convert self
into an unsafe handle.
impl<T> IntoUnsafeSocket for T where
T: IntoRawFd + OwnsRaw,
[src]
impl<T> IntoUnsafeSocket for T where
T: IntoRawFd + OwnsRaw,
[src]pub fn into_unsafe_socket(self) -> UnsafeSocket
[src]
pub fn into_unsafe_socket(self) -> UnsafeSocket
[src]Convert self
into an unsafe socket.
impl<T> SetTimes for T where
T: AsUnsafeFile,
impl<T> SetTimes for T where
T: AsUnsafeFile,