server/ipc/ipc_unix.go

17 lines
304 B
Go
Raw Normal View History

2017-10-26 12:30:55 +00:00
package ipc
import (
"net"
"os"
"path/filepath"
)
func (sh *ServerHandlers) Listen() (net.Listener, error) {
sh.path = filepath.Join(os.TempDir(), sh.Addr)
if err := os.Remove(sh.path); nil != err {
return nil, err
}
return net.ListenUnix("unix", &net.UnixAddr{Name: sh.path, Net: "unix"})
}