mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-28 12:10:37 +00:00
update the docs of net::*::bind
This commit is contained in:
parent
00fb7ea4a3
commit
32ccf255b5
@ -27,9 +27,8 @@ pub struct Incoming {
|
||||
impl TcpListener {
|
||||
/// Create a new TCP listener associated with this event loop.
|
||||
///
|
||||
/// The TCP listener will bind to the provided `addr` address, if available,
|
||||
/// and will be returned as a future. The returned future, if resolved
|
||||
/// successfully, can then be used to accept incoming connections.
|
||||
/// The TCP listener will bind to the provided `addr` address, if available.
|
||||
/// If the result is `Ok`, the socket has successfully bound.
|
||||
pub fn bind(addr: &SocketAddr, handle: &Handle) -> io::Result<TcpListener> {
|
||||
let l = try!(mio::tcp::TcpListener::bind(addr));
|
||||
TcpListener::new(l, handle)
|
||||
|
@ -16,9 +16,7 @@ impl UdpSocket {
|
||||
/// Create a new UDP socket bound to the specified address.
|
||||
///
|
||||
/// This function will create a new UDP socket and attempt to bind it to the
|
||||
/// `addr` provided. The returned future will be resolved once the socket
|
||||
/// has successfully bound. If an error happens during the binding or during
|
||||
/// the socket creation, that error will be returned to the future instead.
|
||||
/// `addr` provided. If the result is `Ok`, the socket has successfully bound.
|
||||
pub fn bind(addr: &SocketAddr, handle: &Handle) -> io::Result<UdpSocket> {
|
||||
let udp = try!(mio::udp::UdpSocket::bind(addr));
|
||||
UdpSocket::new(udp, handle)
|
||||
|
Loading…
x
Reference in New Issue
Block a user