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
+17.3k Golang : How to tell if a file is compressed either gzip or zip ?
+9.4k Golang : Terminate-stay-resident or daemonize your program?
+39k Golang : How to iterate over a []string(array)
+9.5k Golang : Extract or copy items from map based on value
+17.4k Golang : Multi threading or run two processes or more example
+5.5k Golang : Stop goroutine without channel
+19.9k Golang : Measure http.Get() execution time
+12.7k Android Studio : Highlight ImageButton when pressed on example
+25.4k Golang : Generate MD5 checksum of a file
+5.6k Swift : Get substring with rangeOfString() function example
+6.8k Android Studio : Hello World example
+9.2k Golang : How to check if a string with spaces in between is numeric?