1
0
mirror of https://github.com/golang/go synced 2024-11-24 22:57:57 -07:00

net: add File method to IPConn

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5237041
This commit is contained in:
Mikio Hara 2011-10-07 22:53:12 +09:00
parent 2b95cfbac3
commit b5260364b1

View File

@ -305,3 +305,8 @@ func (c *IPConn) BindToDevice(device string) os.Error {
defer c.fd.decref()
return os.NewSyscallError("setsockopt", syscall.BindToDevice(c.fd.sysfd, device))
}
// File returns a copy of the underlying os.File, set to blocking mode.
// It is the caller's responsibility to close f when finished.
// Closing c does not affect f, and closing f does not affect c.
func (c *IPConn) File() (f *os.File, err os.Error) { return c.fd.dup() }