From e38c5fb23da137c822455126628a5b2bb68fc440 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 8 Mar 2012 08:36:40 -0500 Subject: [PATCH] net: document ReadMsgUnix, WriteMsgUnix Fixes #3247. R=golang-dev, jsing CC=golang-dev https://golang.org/cl/5784051 --- src/pkg/net/unixsock_posix.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/pkg/net/unixsock_posix.go b/src/pkg/net/unixsock_posix.go index 5be028f953..37a2b1e09e 100644 --- a/src/pkg/net/unixsock_posix.go +++ b/src/pkg/net/unixsock_posix.go @@ -208,8 +208,8 @@ func (c *UnixConn) SetWriteBuffer(bytes int) error { } // ReadFromUnix reads a packet from c, copying the payload into b. -// It returns the number of bytes copied into b and the return address -// that was on the packet. +// It returns the number of bytes copied into b and the source address +// of the packet. // // ReadFromUnix can be made to time out and return // 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) { 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) { if !c.ok() { return 0, 0, 0, nil, syscall.EINVAL @@ -276,6 +281,9 @@ func (c *UnixConn) ReadMsgUnix(b, oob []byte) (n, oobn, flags int, addr *UnixAdd 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) { if !c.ok() { return 0, 0, syscall.EINVAL -- 2.50.0