From 7e2813ad351a0806072a167cba9c478645c6c833 Mon Sep 17 00:00:00 2001 From: crusader Date: Tue, 5 Dec 2017 11:52:14 +0900 Subject: [PATCH] ing --- client/socket_builders.go | 6 +++++- server/server_handlers.go | 6 ++++++ server/server_handlers_unix.go | 26 +++++++++++++------------- server/server_handlers_windows.go | 24 ++++++++++++------------ 4 files changed, 36 insertions(+), 26 deletions(-) diff --git a/client/socket_builders.go b/client/socket_builders.go index d6292e8..d2e0c83 100644 --- a/client/socket_builders.go +++ b/client/socket_builders.go @@ -5,7 +5,11 @@ import ( ) func NewSocketBuilder(address string) csc.SocketBuilder { - return newSocketBuilder(address) + sb := &SocketBuilders{} + sb.Network = "tcp" + sb.Address = "localhost:50006" + + return sb } type SocketBuilders struct { diff --git a/server/server_handlers.go b/server/server_handlers.go index 59314a3..2f53a27 100644 --- a/server/server_handlers.go +++ b/server/server_handlers.go @@ -2,6 +2,7 @@ package server import ( "fmt" + "net" "git.loafle.net/commons_go/logging" "git.loafle.net/overflow/overflow_discovery/discovery" @@ -33,6 +34,11 @@ 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 4aad065..72c246f 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 4c51a3e..cb6a676 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 +// }