Skip to content

Commit

Permalink
Fix Socket example
Browse files Browse the repository at this point in the history
Bind an IPv6 address to an IPv6 socket, and only do it once.
  • Loading branch information
pabigot authored and Thomasdezeeuw committed Dec 21, 2022
1 parent 05ca989 commit fa67e04
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,12 @@ use crate::{MaybeUninitSlice, RecvFlags};
/// use std::net::{SocketAddr, TcpListener};
/// use socket2::{Socket, Domain, Type};
///
/// // create a TCP listener bound to two addresses
/// let socket = Socket::new(Domain::IPV4, Type::STREAM, None)?;
/// // create a TCP listener
/// let socket = Socket::new(Domain::IPV6, Type::STREAM, None)?;
///
/// let address: SocketAddr = "[::1]:12345".parse().unwrap();
/// let address = address.into();
/// socket.bind(&address)?;
/// socket.bind(&address)?;
/// socket.listen(128)?;
///
/// let listener: TcpListener = socket.into();
Expand Down

0 comments on commit fa67e04

Please sign in to comment.