Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: add ReadMsg and WriteMsg methods to {TCP,UDP,IP,Unix}Conn #7882

Closed
mikioh opened this issue Apr 28, 2014 · 4 comments
Closed

net: add ReadMsg and WriteMsg methods to {TCP,UDP,IP,Unix}Conn #7882

mikioh opened this issue Apr 28, 2014 · 4 comments
Milestone

Comments

@mikioh
Copy link
Contributor

@mikioh mikioh commented Apr 28, 2014

Just saw a few suggestions in docker talk at gophercon 2014:
https://cdn.rawgit.com/gophercon/2014-talks/master/Making_Docker_GO_victor_vieux_gophercon2014.pdf.

--
The syscall package isn’t perfect: 
– sendmsg() wrapper missing return value 
– RecvMsg doesn’t pass MSG_CMSG_CLOEXEC
--

The former is fixed in issue #7645, the latter might be metioning ReadMsg{IP,UDP,Unix}
methods in the net package. Perhaps adding ReadMsg/WriteMsg with platform agnostic
control message flags might make sense for people who must work with AF_LOCAL/AF_UNIX
with ancillary data deeply.

A dumb API sketch:

type MsgFlags int
const (
        MsgFlagOOB = MsgFlags = 1<< iota
        ...
        MsgFlagCloseOnExec
)

func (c *TCPConn) ReadMsg(b, oob []byte, flags MsgFlags) (n, oobn int, rdflags MsgFlags,
addr Addr, err error)
func (c *UDPConn) ReadMsg(b, oob []byte, flags MsgFlags) (n, oobn int, rdflags MsgFlags,
addr Addr, err error)
func (c *IPConn) ReadMsg(b, oob []byte, flags MsgFlags) (n, oobn int, rdflags MsgFlags,
addr Addr, err error)
func (c *UnixConn) ReadMsg(b, oob []byte, flags MsgFlags) (n, oobn int, rdflags
MsgFlags, addr Addr, err error)

func (c *TCPConn) WriteMsg(b, oob []byte, flags MsgFlags) (n, oobn int, err error)
func (c *UDPConn) ReadMsg(b, oob []byte, flags MsgFlags) (n, oobn int, err error)
func (c *IPConn) ReadMsg(b, oob []byte, flags MsgFlags) (n, oobn int, err error)
func (c *UnixConn) ReadMsg(b, oob []byte, flags MsgFlags) (n, oobn int, err error)
@mikioh

This comment has been minimized.

Copy link
Contributor Author

@mikioh mikioh commented Apr 28, 2014

Comment 1:

For the record, syscall package doesn't look so bad:
func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from
Sockaddr, err error)
func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error)
@rsc

This comment has been minimized.

Copy link
Contributor

@rsc rsc commented May 21, 2014

Comment 2:

I don't understand the subject. What is ProtocolConn(s) ?

Labels changed: added release-none.

@mikioh

This comment has been minimized.

Copy link
Contributor Author

@mikioh mikioh commented Aug 13, 2014

Comment 4:

Labels changed: removed release-none.

Status changed to New.

@mikioh mikioh added new labels Aug 13, 2014
@bradfitz bradfitz removed the new label Dec 18, 2014
@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc removed the repo-main label Apr 14, 2015
@mikioh mikioh changed the title net: add ReadMsg and WriteMsg methods to {UDP,IP,Unix}Conn net: add ReadMsg and WriteMsg methods to {TCP,UDP,IP,Unix}Conn Aug 14, 2015
@mikioh

This comment has been minimized.

Copy link
Contributor Author

@mikioh mikioh commented Dec 28, 2018

#24331 provides a way to make socket descriptors work together with the runtime-integrated network poller, so I'll merge this issue into #24331.

@mikioh mikioh closed this Dec 28, 2018
@golang golang locked and limited conversation to collaborators Dec 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.