Golang net.FileListener() and os.NewFile() functions example

package net

Golang net.FileListener() and os.NewFile() functions usage example

 file := os.NewFile(3, "")
 ln, err = net.FileListener(file)

NOTE : From the source code ( https://golang.org/src/os/file_unix.go?s=1063:1106#L31 ) ... NewFile does not create a new file, all it does is to setup a Go os.File wrapper with the given file descriptor (see http://www.theunixschool.com/2010/08/unix-file-descriptors.html )

References :

https://golang.org/src/os/file_unix.go?s=1063:1106#L31

http://www.theunixschool.com/2010/08/unix-file-descriptors.html

http://golang.org/pkg/net/#FileListener

Advertisement