Commit e38c5fb2 authored by Russ Cox's avatar Russ Cox

net: document ReadMsgUnix, WriteMsgUnix

Fixes #3247.

R=golang-dev, jsing
CC=golang-dev
https://golang.org/cl/5784051
parent 2ee538bc
...@@ -208,8 +208,8 @@ func (c *UnixConn) SetWriteBuffer(bytes int) error { ...@@ -208,8 +208,8 @@ func (c *UnixConn) SetWriteBuffer(bytes int) error {
} }
// ReadFromUnix reads a packet from c, copying the payload into b. // ReadFromUnix reads a packet from c, copying the payload into b.
// It returns the number of bytes copied into b and the return address // It returns the number of bytes copied into b and the source address
// that was on the packet. // of the packet.
// //
// ReadFromUnix can be made to time out and return // ReadFromUnix can be made to time out and return
// an error with Timeout() == true after a fixed time limit; // an error with Timeout() == true after a fixed time limit;
...@@ -264,6 +264,11 @@ func (c *UnixConn) WriteTo(b []byte, addr Addr) (n int, err error) { ...@@ -264,6 +264,11 @@ func (c *UnixConn) WriteTo(b []byte, addr Addr) (n int, err error) {
return c.WriteToUnix(b, a) return c.WriteToUnix(b, a)
} }
// ReadMsgUnix reads a packet from c, copying the payload into b
// and the associated out-of-band data into oob.
// It returns the number of bytes copied into b, the number of
// bytes copied into oob, the flags that were set on the packet,
// and the source address of the packet.
func (c *UnixConn) ReadMsgUnix(b, oob []byte) (n, oobn, flags int, addr *UnixAddr, err error) { func (c *UnixConn) ReadMsgUnix(b, oob []byte) (n, oobn, flags int, addr *UnixAddr, err error) {
if !c.ok() { if !c.ok() {
return 0, 0, 0, nil, syscall.EINVAL return 0, 0, 0, nil, syscall.EINVAL
...@@ -276,6 +281,9 @@ func (c *UnixConn) ReadMsgUnix(b, oob []byte) (n, oobn, flags int, addr *UnixAdd ...@@ -276,6 +281,9 @@ func (c *UnixConn) ReadMsgUnix(b, oob []byte) (n, oobn, flags int, addr *UnixAdd
return return
} }
// WriteMsgUnix writes a packet to addr via c, copying the payload from b
// and the associated out-of-band data from oob. It returns the number
// of payload and out-of-band bytes written.
func (c *UnixConn) WriteMsgUnix(b, oob []byte, addr *UnixAddr) (n, oobn int, err error) { func (c *UnixConn) WriteMsgUnix(b, oob []byte, addr *UnixAddr) (n, oobn int, err error) {
if !c.ok() { if !c.ok() {
return 0, 0, syscall.EINVAL return 0, 0, syscall.EINVAL
......
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