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
Advertisement
Something interesting
Tutorials
+8.6k Golang : Set or add headers for many or different handlers
+12.4k Golang : Encrypt and decrypt data with x509 crypto
+87.7k Golang : How to convert character to ASCII and back
+16.9k Golang : How to generate QR codes?
+7.7k Golang : Generate human readable password
+9.8k Golang : Resumable upload to Google Drive(RESTful) example
+10.3k Golang : Wait and sync.WaitGroup example
+5.7k Golang : Struct field tags and what is their purpose?
+14.9k Golang : Submit web forms without browser by http.PostForm example
+19.9k Golang : How to get time from unix nano example
+3.7k Golang : Switch Redis database redis.NewClient
+20.2k Golang : Determine if directory is empty with os.File.Readdir() function