Commit 28323391 authored by Mikio Hara's avatar Mikio Hara

go.net/ipv4: update doc

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/6996045
parent 0e4f6eb3
......@@ -110,7 +110,7 @@
//
// b := make([]byte, 1500)
// for {
// n, cm, src, err := p.Read(b)
// n, cm, src, err := p.ReadFrom(b)
// if err != nil {
// // error handling
// }
......@@ -127,7 +127,7 @@
//
// p.SetTOS(ipv4.DSCP_CS0)
// p.SetTTL(16)
// _, err = p.Write(data, nil, src)
// _, err = p.WriteTo(data, nil, src)
// if err != nil {
// // error handling
// }
......@@ -138,7 +138,7 @@
// // error handling
// }
// p.SetMulticastTTL(2)
// _, err = p.Write(data, nil, dst)
// _, err = p.WriteTo(data, nil, dst)
// if err != nil {
// // error handling
// }
......
......@@ -38,11 +38,11 @@ func runPayloadTransponder(t *testing.T, c *ipv4.PacketConn, wb []byte, dst net.
}
c.SetDeadline(time.Now().Add(100 * time.Millisecond))
if _, err := c.WriteTo(wb, nil, dst); err != nil {
t.Fatalf("ipv4.PacketConn.Write failed: %v", err)
t.Fatalf("ipv4.PacketConn.WriteTo failed: %v", err)
}
_, cm, _, err := c.ReadFrom(rb)
if err != nil {
t.Fatalf("ipv4.PacketConn.Read failed: %v", err)
t.Fatalf("ipv4.PacketConn.ReadFrom failed: %v", err)
}
t.Logf("rcvd cmsg: %v", cm)
}
......@@ -73,11 +73,11 @@ func runDatagramTransponder(t *testing.T, c *ipv4.RawConn, wb []byte, src, dst n
}
c.SetDeadline(time.Now().Add(100 * time.Millisecond))
if err := c.WriteTo(wh, wb, nil); err != nil {
t.Fatalf("ipv4.RawConn.Write failed: %v", err)
t.Fatalf("ipv4.RawConn.WriteTo failed: %v", err)
}
rh, _, cm, err := c.ReadFrom(rb)
if err != nil {
t.Fatalf("ipv4.RawConn.Read failed: %v", err)
t.Fatalf("ipv4.RawConn.ReadFrom failed: %v", err)
}
t.Logf("rcvd cmsg: %v", cm.String())
t.Logf("rcvd hdr: %v", rh.String())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment