@@ -17,10 +17,25 @@ use sys_common::net as net_imp;
17
17
use sys_common:: { AsInner , FromInner , IntoInner } ;
18
18
use time:: Duration ;
19
19
20
- /// A structure which represents a TCP stream between a local socket and a
21
- /// remote socket.
20
+ /// A TCP stream between a local and a remote socket.
22
21
///
23
- /// The socket will be closed when the value is dropped.
22
+ /// After creating a `TcpStream` by either [`connect`]ing to a remote host or
23
+ /// [`accept`]ing a connection on a [`TcpListener`], data can be transmitted
24
+ /// by [reading] and [writing] to it.
25
+ ///
26
+ /// The connection will be closed when the value is dropped. The reading and writing
27
+ /// portions of the connection can also be shut down individually with the [`shutdown`]
28
+ /// method.
29
+ ///
30
+ /// The Transmission Control Protocol is specified in [IETF RFC 793].
31
+ ///
32
+ /// [`accept`]: ../../std/net/struct.TcpListener.html#method.accept
33
+ /// [`connect`]: #method.connect
34
+ /// [IETF RFC 793]: https://tools.ietf.org/html/rfc793
35
+ /// [reading]: ../../std/io/trait.Read.html
36
+ /// [`shutdown`]: #method.shutdown
37
+ /// [`TcpListener`]: ../../std/net/struct.TcpListener.html
38
+ /// [writing]: ../../std/io/trait.Write.html
24
39
///
25
40
/// # Examples
26
41
///
@@ -39,7 +54,21 @@ use time::Duration;
39
54
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
40
55
pub struct TcpStream ( net_imp:: TcpStream ) ;
41
56
42
- /// A structure representing a socket server.
57
+ /// A TCP socket server, listening for connections.
58
+ ///
59
+ /// After creating a `TcpListener` by [`bind`]ing it to a socket address, it listens
60
+ /// for incoming TCP connections. These can be accepted by calling [`accept`] or by
61
+ /// iterating over the [`Incoming`] iterator returned by [`incoming`].
62
+ ///
63
+ /// The socket will be closed when the value is dropped.
64
+ ///
65
+ /// The Transmission Control Protocol is specified in [IETF RFC 793].
66
+ ///
67
+ /// [`accept`]: #method.accept
68
+ /// [`bind`]: #method.bind
69
+ /// [IETF RFC 793]: https://tools.ietf.org/html/rfc793
70
+ /// [`Incoming`]: ../../std/net/struct.Incoming.html
71
+ /// [`incoming`]: #method.incoming
43
72
///
44
73
/// # Examples
45
74
///
0 commit comments