pub fn connect(sock: BorrowedFd<'_>, address: &SocketAddr) -> Result<(), Errno>Expand description
Initie une connexion vers un pair.
Wrappeur de connect(2). Pour les sockets non-bloquants, retourne
immédiatement EINPROGRESS ; la connexion est terminée quand le
socket devient writable (via poll/epoll/io_uring).
§Parameters
sock: FD du socket.address: adresse du pair.
§Errors
ECONNREFUSED: le pair refuse la connexion (Unix : socket absent).EINPROGRESS: connexion en cours (socket non-bloquant).EALREADY: connexion déjà en cours.EISCONN: socket déjà connecté.ETIMEDOUT: expiration du délai de connexion.
§Examples
use air_sys_syscall::net::{socket, connect};
use air_sys_types::net::{SocketAddr, SocketDomain, SocketType, UnixSocketAddr};
use air_sys_types::fd::AsFd;
let fd = socket(SocketDomain::Unix, SocketType::Stream, 0).expect("socket");
connect(fd.as_fd(), &SocketAddr::Unix(UnixSocketAddr::Path(
std::ffi::CString::new("/run/conduit.sock").expect("cstring"),
))).expect("connect");