summaryrefslogtreecommitdiff
path: root/src/net/example_test.go
diff options
context:
space:
mode:
authorMikio Hara <mikioh.mikioh@gmail.com>2018-06-25 02:08:52 +0900
committerMikio Hara <mikioh.mikioh@gmail.com>2018-06-26 21:30:43 +0000
commit0436b162397018c45068b47ca1b5924a3eafdee0 (patch)
tree489f58e2044d84a7cbce2d855a22e2988eede897 /src/net/example_test.go
parenta12c1f26e4cc602dae62ec065a237172a5b8f926 (diff)
downloadgo-git-0436b162397018c45068b47ca1b5924a3eafdee0.tar.gz
net: improve ExampleUDPConn_WriteTo docs
Also updates comment on isConnected field of netFD for clarification. Change-Id: Icb1b0332e3b4c7802eae00ddc26cd5ba54c82dc2 Reviewed-on: https://go-review.googlesource.com/120955 Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/net/example_test.go')
-rw-r--r--src/net/example_test.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/net/example_test.go b/src/net/example_test.go
index 8126a28404..e4d732e68a 100644
--- a/src/net/example_test.go
+++ b/src/net/example_test.go
@@ -121,7 +121,8 @@ func ExampleIPv4Mask() {
}
func ExampleUDPConn_WriteTo() {
- // Create connection in non-pre-connected state
+ // Unlike Dial, ListenPacket creates a connection without any
+ // association with peers.
conn, err := net.ListenPacket("udp", ":0")
if err != nil {
log.Fatal(err)
@@ -133,7 +134,7 @@ func ExampleUDPConn_WriteTo() {
log.Fatal(err)
}
- // Write data to the desired address
+ // The connection can write data to the desired address.
_, err = conn.WriteTo([]byte("data"), dst)
if err != nil {
log.Fatal(err)