21 lines
328 B
Go
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)
|
|
}
|