MCPcopy Create free account
hub / github.com/bytecodealliance/rustix / bind

Function bind

src/net/socket.rs:124–126  ·  view source on GitHub ↗

`bind(sockfd, addr)`—Binds a socket to an IP address. # References - [Beej's Guide to Network Programming] - [POSIX] - [Linux] - [Apple] - [Winsock] - [FreeBSD] - [NetBSD] - [OpenBSD] - [DragonFly BSD] - [illumos] - [glibc] [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#bind [POSIX]: https://pubs.opengroup.org/onlinepubs/9799919799/functio

(sockfd: Fd, addr: &impl SocketAddrArg)

Source from the content-addressed store, hash-verified

122/// [illumos]: https://illumos.org/man/3SOCKET/bind
123/// [glibc]: https://sourceware.org/glibc/manual/latest/html_node/Setting-Address.html
124pub fn bind<Fd: AsFd>(sockfd: Fd, addr: &impl SocketAddrArg) -> io::Result<()> {
125 backend::net::syscalls::bind(sockfd.as_fd(), addr)
126}
127
128/// `connect(sockfd, addr)`—Initiates a connection to an IP address.
129///

Callers 15

test_close_socketFunction · 0.50
test_socketopts_ip_mtuFunction · 0.50
test_socketopts_ipv6_mtuFunction · 0.50
serverFunction · 0.50
do_test_unix_msgFunction · 0.50
test_unix_msg_with_comboFunction · 0.50
net_dgram_v4_connect_anyFunction · 0.50
net_dgram_v6_connect_anyFunction · 0.50

Calls 1

as_fdMethod · 0.45

Tested by 15

test_close_socketFunction · 0.40
test_socketopts_ip_mtuFunction · 0.40
test_socketopts_ipv6_mtuFunction · 0.40
test_unix_msg_with_comboFunction · 0.40
net_dgram_v4_connect_anyFunction · 0.40
net_dgram_v6_connect_anyFunction · 0.40
net_dgram_v4_connectFunction · 0.40
net_dgram_v6_connectFunction · 0.40
net_dgram_v4_bind_anyFunction · 0.40