server/ipc/server_handlers_unix.go
crusader 4163705d49 ing
2017-10-27 16:07:14 +09:00

21 lines
328 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) Stopped() {
os.Remove(sh.Addr)
}