self.0.ttl()
}
- /// Get the value of the `SO_ERROR` option on this socket.
+ /// Gets the value of the `SO_ERROR` option on this socket.
///
/// This will retrieve the stored error in the underlying socket, clearing
/// the field in the process. This can be useful for checking errors between
///
/// # Examples
///
- /// Create a TCP listener bound to `127.0.0.1:80`:
+ /// Creates a TCP listener bound to `127.0.0.1:80`:
///
/// ```no_run
/// use std::net::TcpListener;
/// let listener = TcpListener::bind("127.0.0.1:80").unwrap();
/// ```
///
- /// Create a TCP listener bound to `127.0.0.1:80`. If that fails, create a
+ /// Creates a TCP listener bound to `127.0.0.1:80`. If that fails, create a
/// TCP listener bound to `127.0.0.1:443`:
///
/// ```no_run
self.0.only_v6()
}
- /// Get the value of the `SO_ERROR` option on this socket.
+ /// Gets the value of the `SO_ERROR` option on this socket.
///
/// This will retrieve the stored error in the underlying socket, clearing
/// the field in the process. This can be useful for checking errors between
#[test]
fn double_bind() {
each_ip(&mut |addr| {
- let _listener = t!(TcpListener::bind(&addr));
+ let listener1 = t!(TcpListener::bind(&addr));
match TcpListener::bind(&addr) {
- Ok(..) => panic!(),
+ Ok(listener2) => panic!(
+ "This system (perhaps due to options set by TcpListener::bind) \
+ permits double binding: {:?} and {:?}",
+ listener1, listener2
+ ),
Err(e) => {
assert!(e.kind() == ErrorKind::ConnectionRefused ||
e.kind() == ErrorKind::Other ||