- New
all
feature: enables API that is not available on all tier 1 platforms. SockRef
type: used to create a reference to an existing socket, e.g.std::net::TcpStream
, making all methods ofSocket
available on it.- Support for vectored I/O:
Socket::recv_vectored
,Socket::recv_with_flags
.Socket::recv_from_vectored
,Socket::recv_from_vectored_with_flags
.Socket::send_vectored
,Socket::send_vectored_with_flags
.Socket::send_to_vectored
,Socket::send_to_vectored_with_flags
.- In the
Read
andWrite
implementations.
Socket::new_raw
,Socket::pair_raw
andSocket::accept_raw
methods that don't set common flags, such as the close-on-exec flag.Socket::accept4
:accept4(2)
system call.Socket::sendfile
: thesendfile(2)
system call.Socket::set_cloexec
: set the close-on-exec flag on Unix.Socket::set_no_inherit
: set inherit handle flag on Windows.Socket::set_nosigpipe
: setSO_NOSIGPIPE
on Apple targets.Socket::set_mark
andSocket::mark
, setting/getting theSO_MARK
socket option.Socket::set_cpu_affinity
andSocket::cpu_affinity
, setting/getting theSO_INCOMING_CPU
socket option.Socket::set_mss
andSocket::mss
, setting/getting theTCP_MAXSEG
socket option.Socket::set_freebind
andSocket::freebind
, setting/getting theIP_FREEBIND
socket option.Socket::bind_device
andSocket::device
, setting/getting theSO_BINDTODEVICE
socket option.- Adopted Mio's TCP keepalive API:
Socket::keepalive_time
,Socket::keepalive_interval
,Socket::keepalive_retries
,Socket::set_tcp_keepalive
.
Socket::is_listener
getting theSO_ACCEPTCONN
socket option.Socket::domain
getting theSO_DOMAIN
socket option.Socket::protocol
getting theSO_PROTOCOL
socket option.Socket::type
getting theSO_TYPE
socket option.Domain::for_address
: the correctDomain
for astd::net::SocketAddr
.Type::nonblocking
: setSOCK_NONBLOCK
.Type::cloexec
: setSOCK_CLOEXEC
.Type::no_inherit
: setHANDLE_FLAG_INHERIT
.SockAddr::init
: initialises aSockAddr
.MaybeUninitSlice
type: a version ofIoSliceMut
that allows the buffer to be uninitialised, used inSocket::recv_vectored
and related functions.RecvFlags
type: provides additional information about incoming messages, returned bySocket::recv_vectored
and related functions.TcpKeepalive
type: configuration type for a socket's TCP keepalive parameters.
- Repository moved to https://github.com/rust-lang/socket2.
- BREAKING: Changed constructor functions into constants:
Domain::ipv4
=>Domain::IPV4
.Domain::ipv6
=>Domain::IPV4
.Domain::unix
=>Domain::UNIX
.Domain::packet
=>Domain::PACKET
.Type::stream
=>Type::STREAM
.Type::dgram
=>Type::DGRAM
.Type::seqpacket
=>Type::SEQPACKET
.Type::raw
=>Type::RAW
.Protocol::icmpv4
=>Protocol::ICMPV4
.Protocol::icmpv6
=>Protocol::ICMPV6
.Protocol::tcp
=>Protocol::TCP
.Protocol::udp
=>Protocol::UDP
.
- BREAKING: Changed the signature of
Socket::recv
,Socket::recv_vectored
and related methods to accept unitialised buffers. TheRead
implementation can be used to read into initialised buffers. - BREAKING: Renamed
SockAddr::as_std
toas_socket
. - BREAKING: Renamed
SockAddr::as_inet
toas_socket_ipv4
. - BREAKING: Renamed
SockAddr::as_inet6
toas_socket_ipv6
. - BREAKING: Replace all previously existing features (reuseport, pair, unix) with a new all features (see above for description of the all feature).
- Use
accept4(2)
withSOCK_CLOEXEC
inSocket::accept
, reducing the amount of system calls required. - Marked many functions as constant.
- The
Read
implementation now callsrecv(2)
rather thanread(2)
. - Split the
impl
block for theSocket
type to create groupings for setting and getting different level socket options usingsetsockopt(2)
/getsockopt(2)
. - Updated
winapi
depdency to version 0.3.9 and dropped unused features.
- Removed the
-rs
suffix from the repository name. - BREAKING: Removed
SockAddr::from_raw_parts
, useSockAddr::init
instead. - BREAKING: Removed
Socket::into_*
functions and replaced them with aFrom
implementation:Socket::into_tcp_stream
=>TcpStream::from(socket)
.Socket::into_tcp_listener
=>TcpListener::from(socket)
.Socket::into_udp_socket
=>UdpSocket::from(socket)
.Socket::into_unix_stream
=>UnixStream::from(socket)
.Socket::into_unix_listener
=>UnixListener::from(socket)
.Socket::into_unix_datagram
=>UnixDatagram::from(socket)
.
- Removed
cfg-if
dependency. - Remove
redox_syscall
depdency.
- Fixes the Andoid, Fuchsia, Haiku, iOS, illumos, NetBSD and Redox (nightly only) targets.
- Correctly call
recv_from
inSocket::recv_from_with_flags
(calledrecv
previously). - Correctly call
send_to
inSocket::send_to_with_flags
(calledrecv
previously). - Use correct inmutable references in
Socket::send_with_flags
andSocket::send_out_of_band
. - Use
IPPROTO_IPV6
inSocket::join_multicast_v6
on Windows. - Don't assume the memory layout of
std::net::SocketAddr
. - Use
c_int
instead ofi32
where appropriate.
- Fixes the Fuchsia target.
Socket::device
now returns aVec<u8>
rather thanCString
.Socket::bind_device
now accepts a&[u8]
rather than&CStr
.
Socket::connect_timeout
was added back.
- Changed
Socket::set_cpu_affinity
andSocket::cpu_affinity
to use an immutable reference.
- Use
SO_LINGER_SEC
on macOS forSocket::get/set_linger
.