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
+12.1k Golang : Sort and reverse sort a slice of runes
+12.7k Golang : Add ASCII art to command line application launching process
+15.6k Chrome : ERR_INSECURE_RESPONSE and allow Chrome browser to load insecure content
+6.1k Golang : How to write backslash in string?
+10.7k Golang : Interfacing with PayPal's IPN(Instant Payment Notification) example
+28.6k Golang : Read, Write(Create) and Delete Cookie example
+5.4k Javascript : How to loop over and parse JSON data?
+14.4k Golang : Parsing or breaking down URL
+17.3k Golang : How to tell if a file is compressed either gzip or zip ?
+10.1k Golang : Identifying Golang HTTP client request
+9.6k Golang : Read file with ioutil
+44.9k Golang : Use wildcard patterns with filepath.Glob() example