21 lines
327 B
Go
21 lines
327 B
Go
package ipc
|
|
|
|
import (
|
|
"net"
|
|
"os"
|
|
)
|
|
|
|
// Addr is ex:/tmp/server.sock
|
|
func (sh *ServerHandlers) Listen() (l net.Listener, err error) {
|
|
os.Remove(sh.Addr)
|
|
l, err = net.ListenUnix("unix", &net.UnixAddr{Name: sh.Addr, Net: "unix"})
|
|
|
|
os.Chmod(sh.Addr, 0777)
|
|
|
|
return
|
|
}
|
|
|
|
func (sh *ServerHandlers) OnStop() {
|
|
os.Remove(sh.Addr)
|
|
}
|