go.net/ipv4: change I/O method signatures on PacketConn and RawConn

Preserves both Read and Write signatures for the future usage.

R=dave, rsc
CC=golang-dev
https://golang.org/cl/6970048
diff --git a/ipv4/example_test.go b/ipv4/example_test.go
index 500d125..ac202d3 100644
--- a/ipv4/example_test.go
+++ b/ipv4/example_test.go
@@ -69,7 +69,7 @@
 
 	b := make([]byte, 1500)
 	for {
-		n, cm, src, err := p.Read(b)
+		n, cm, src, err := p.ReadFrom(b)
 		if err != nil {
 			log.Fatal(err)
 		}
@@ -83,7 +83,7 @@
 		}
 		p.SetTOS(ipv4.DSCP_CS7)
 		p.SetTTL(16)
-		_, err = p.Write(b[:n], nil, src)
+		_, err = p.WriteTo(b[:n], nil, src)
 		if err != nil {
 			log.Fatal(err)
 		}
@@ -94,7 +94,7 @@
 				log.Fatal(err)
 			}
 			p.SetMulticastTTL(2)
-			_, err = p.Write(b[:n], nil, dst)
+			_, err = p.WriteTo(b[:n], nil, dst)
 			if err != nil {
 				log.Fatal(err)
 			}
@@ -193,7 +193,7 @@
 
 	b := make([]byte, 1500)
 	for {
-		iph, p, _, err := r.Read(b)
+		iph, p, _, err := r.ReadFrom(b)
 		if err != nil {
 			log.Fatal(err)
 		}
@@ -275,7 +275,7 @@
 		if err != nil {
 			return
 		}
-		err = r.Write(iph, ospf, nil)
+		err = r.WriteTo(iph, ospf, nil)
 		if err != nil {
 			return
 		}
diff --git a/ipv4/mocktransponder_test.go b/ipv4/mocktransponder_test.go
index 99759ef..4b57f18 100644
--- a/ipv4/mocktransponder_test.go
+++ b/ipv4/mocktransponder_test.go
@@ -37,10 +37,10 @@
 			c.SetTTL(i + 1)
 		}
 		c.SetDeadline(time.Now().Add(100 * time.Millisecond))
-		if _, err := c.Write(wb, nil, dst); err != nil {
+		if _, err := c.WriteTo(wb, nil, dst); err != nil {
 			t.Fatalf("ipv4.PacketConn.Write failed: %v", err)
 		}
-		_, cm, _, err := c.Read(rb)
+		_, cm, _, err := c.ReadFrom(rb)
 		if err != nil {
 			t.Fatalf("ipv4.PacketConn.Read failed: %v", err)
 		}
@@ -72,10 +72,10 @@
 			wh.Dst = dst.(*net.IPAddr).IP
 		}
 		c.SetDeadline(time.Now().Add(100 * time.Millisecond))
-		if err := c.Write(wh, wb, nil); err != nil {
+		if err := c.WriteTo(wh, wb, nil); err != nil {
 			t.Fatalf("ipv4.RawConn.Write failed: %v", err)
 		}
-		rh, _, cm, err := c.Read(rb)
+		rh, _, cm, err := c.ReadFrom(rb)
 		if err != nil {
 			t.Fatalf("ipv4.RawConn.Read failed: %v", err)
 		}
diff --git a/ipv4/packet.go b/ipv4/packet.go
index 3847a9e..2e8f3a7 100644
--- a/ipv4/packet.go
+++ b/ipv4/packet.go
@@ -17,10 +17,10 @@
 
 func (c *packetHandler) ok() bool { return c != nil && c.c != nil }
 
-// Read reads an IPv4 datagram from the endpoint c, copying the
+// ReadFrom reads an IPv4 datagram from the endpoint c, copying the
 // datagram into b.  It returns the received datagram as the IPv4
 // header h, the payload p and the control message cm.
-func (c *packetHandler) Read(b []byte) (h *Header, p []byte, cm *ControlMessage, err error) {
+func (c *packetHandler) ReadFrom(b []byte) (h *Header, p []byte, cm *ControlMessage, err error) {
 	if !c.ok() {
 		return nil, nil, nil, syscall.EINVAL
 	}
@@ -53,7 +53,7 @@
 	return b[:hdrlen], b[hdrlen:], nil
 }
 
-// Write writes an IPv4 datagram through the endpoint c, copying the
+// WriteTo writes an IPv4 datagram through the endpoint c, copying the
 // datagram from the IPv4 header h and the payload p.  The control
 // message cm allows the datagram path and the outgoing interface to be
 // specified.  Currently only Linux supports this.  The cm may be nil
@@ -73,7 +73,7 @@
 //	Src           = platform sets an appropriate value if Src is nil
 //	Dst           = <must be specified>
 //	h.Options     = optional
-func (c *packetHandler) Write(h *Header, p []byte, cm *ControlMessage) error {
+func (c *packetHandler) WriteTo(h *Header, p []byte, cm *ControlMessage) error {
 	if !c.ok() {
 		return syscall.EINVAL
 	}
diff --git a/ipv4/payload.go b/ipv4/payload.go
index bfcf751..9b3c2c9 100644
--- a/ipv4/payload.go
+++ b/ipv4/payload.go
@@ -17,11 +17,11 @@
 
 func (c *payloadHandler) ok() bool { return c != nil && c.c != nil }
 
-// Read reads a payload of the received IPv4 datagram, from the
+// ReadFrom reads a payload of the received IPv4 datagram, from the
 // endpoint c, copying the payload into b.  It returns the number of
 // bytes copied into b, the control message cm and the source address
 // src of the received datagram.
-func (c *payloadHandler) Read(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) {
+func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) {
 	if !c.ok() {
 		return 0, nil, nil, syscall.EINVAL
 	}
@@ -52,13 +52,13 @@
 	return
 }
 
-// Write writes a payload of the IPv4 datagram, to the destination
-// address dst through the endpoint c, copying the payload from b.
-// It returns the number of bytes written.  The control message cm
-// allows the datagram path and the outgoing interface to be
-// specified.  Currently only Linux supports this.  The cm may be nil
-// if control of the outgoing datagram is not required.
-func (c *payloadHandler) Write(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) {
+// WriteTo writes a payload of the IPv4 datagram, to the destination
+// address dst through the endpoint c, copying the payload from b.  It
+// returns the number of bytes written.  The control message cm allows
+// the datagram path and the outgoing interface to be specified.
+// Currently only Linux supports this.  The cm may be nil if control
+// of the outgoing datagram is not required.
+func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) {
 	if !c.ok() {
 		return 0, syscall.EINVAL
 	}