diff --git a/client/socket_builders.go b/client/socket_builders.go index d2e0c83..d6292e8 100644 --- a/client/socket_builders.go +++ b/client/socket_builders.go @@ -5,11 +5,7 @@ import ( ) func NewSocketBuilder(address string) csc.SocketBuilder { - sb := &SocketBuilders{} - sb.Network = "tcp" - sb.Address = "localhost:50006" - - return sb + return newSocketBuilder(address) } type SocketBuilders struct { diff --git a/server/server_handlers.go b/server/server_handlers.go index 2f53a27..59314a3 100644 --- a/server/server_handlers.go +++ b/server/server_handlers.go @@ -2,7 +2,6 @@ package server import ( "fmt" - "net" "git.loafle.net/commons_go/logging" "git.loafle.net/overflow/overflow_discovery/discovery" @@ -34,11 +33,6 @@ func (sh *ServerHandlers) Init(serverCTX server.ServerContext) error { return nil } -func (sh *ServerHandlers) Listen(serverCTX server.ServerContext) (net.Listener, error) { - - return net.Listen("tcp", "localhost:50006") -} - func (sh *ServerHandlers) OnStart(serverCTX server.ServerContext) { sh.ServerHandlers.OnStart(serverCTX) diff --git a/server/server_handlers_unix.go b/server/server_handlers_unix.go index 72c246f..4aad065 100644 --- a/server/server_handlers_unix.go +++ b/server/server_handlers_unix.go @@ -1,17 +1,17 @@ package server -// import ( -// "net" -// "os" +import ( + "net" + "os" -// "git.loafle.net/commons_go/server" -// ) + "git.loafle.net/commons_go/server" +) -// func (sh *ServerHandlers) Listen(serverCTX server.ServerContext) (net.Listener, error) { -// os.Remove(sh.addr) -// l, err := net.ListenUnix("unix", &net.UnixAddr{Name: sh.addr, Net: "unix"}) -// if nil == err { -// os.Chmod(sh.addr, 0777) -// } -// return l, err -// } +func (sh *ServerHandlers) Listen(serverCTX server.ServerContext) (net.Listener, error) { + os.Remove(sh.addr) + l, err := net.ListenUnix("unix", &net.UnixAddr{Name: sh.addr, Net: "unix"}) + if nil == err { + os.Chmod(sh.addr, 0777) + } + return l, err +} diff --git a/server/server_handlers_windows.go b/server/server_handlers_windows.go index cb6a676..4c51a3e 100644 --- a/server/server_handlers_windows.go +++ b/server/server_handlers_windows.go @@ -1,16 +1,16 @@ package server -// import ( -// "net" +import ( + "net" -// "git.loafle.net/commons_go/server" -// "gopkg.in/natefinch/npipe.v2" -// ) + "git.loafle.net/commons_go/server" + "gopkg.in/natefinch/npipe.v2" +) -// func (sh *ServerHandlers) Listen(serverCTX server.ServerContext) (net.Listener, error) { -// ln, err := npipe.Listen(`\\.\pipe\` + sh.addr) -// if err != nil { -// // handle error -// } -// return ln, err -// } +func (sh *ServerHandlers) Listen(serverCTX server.ServerContext) (net.Listener, error) { + ln, err := npipe.Listen(`\\.\pipe\` + sh.addr) + if err != nil { + // handle error + } + return ln, err +}