Updated connect(...) with API changes for TcpStream.

This commit is contained in:
Aaron Weiss 2014-11-06 15:12:57 -05:00
parent f229f4ebaf
commit 8d37f71c3a

View file

@ -16,7 +16,7 @@ impl Connection<BufferedWriter<TcpStream>, BufferedReader<TcpStream>> {
/// Creates a thread-safe TCP connection to the specified server /// Creates a thread-safe TCP connection to the specified server
#[experimental] #[experimental]
pub fn connect(host: &str, port: u16) -> IoResult<Connection<BufferedWriter<TcpStream>, BufferedReader<TcpStream>>> { pub fn connect(host: &str, port: u16) -> IoResult<Connection<BufferedWriter<TcpStream>, BufferedReader<TcpStream>>> {
let socket = try!(TcpStream::connect(host, port)); let socket = try!(TcpStream::connect(format!("{}:{}", host, port)[]));
Ok(Connection::new(BufferedWriter::new(socket.clone()), BufferedReader::new(socket))) Ok(Connection::new(BufferedWriter::new(socket.clone()), BufferedReader::new(socket)))
} }
} }