Struct std::net::Socket
Re-export from std::net::unix::Socket
A network or local socket
Fields
-
fd: FileDescriptor
Methods
impl Socket { ... }
-
Create a new socket with a given family and type
-
fn as_fd(self: &Socket) -> FileDescriptor
-
Shuts down the reading or writing end of the socket or both.
-
fn recv_from_with_flags(self: &Socket, buf: &mut [u8], flags: c_int) -> Result<(usize, SocketAddr)>
-
-
Reads from the stream into a provided buffer.
If successful, returns the number of bytes read. This may be less than the size of the provided buffer.
-
fn peer_addr(self: &Socket) -> Result<SocketAddr>
Returns the address of the remote peer
-
fn socket_addr(self: &Socket) -> Result<SocketAddr>
Returns the address of the remote peer
-
Closes the socket.
Mixins
impl Socket { ... }
-
mixin FdReadWrite<Socket>
-
Write the buffer to the stream.
Returns the number of bytes written. This may be less than the size of the buffer. See also write_all, which can be used to write the entire buffer.