Golang net.ListenUnix() and net.Accept() functions example
package net
Golang net.ListenUnix() and net.Accept() functions usage example
package main
import (
"fmt"
"net"
)
func main() {
unixAddr, err := net.ResolveUnixAddr("unix", "/path_to_unix_service")
if err != nil {
fmt.Println(err)
return
}
unixLn, err := net.ListenUnix("unix", unixAddr )
if err != nil {
fmt.Println(err)
return
}
unixConn, err := unixLn.Accept()
if err != nil {
fmt.Println(err)
return
}
fmt.Println(unixConn)
}
Reference :
http://golang.org/pkg/net/#ListenUnix
Advertisement
Something interesting
Tutorials
+4.3k Javascript : How to show different content with noscript?
+17.5k Golang : Find smallest number in array
+7.1k Golang : Validate credit card example
+12.8k Swift : Convert (cast) Int or int32 value to CGFloat
+30k Golang : Get time.Duration in year, month, week or day
+10.5k Generate Random number with math/rand in Go
+39.2k Golang : How to read CSV file
+11.5k Use systeminfo to find out installed Windows Hotfix(s) or updates
+35.9k Golang : Integer is between a range
+7.3k Golang : Of hash table and hash map
+6.9k Nginx : Password protect a directory/folder
+17.4k Golang : Get future or past hours, minutes or seconds