This commit is contained in:
crusader 2017-12-05 11:52:14 +09:00
parent 32230e44c8
commit 7e2813ad35
4 changed files with 36 additions and 26 deletions

View File

@ -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 {

View File

@ -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)

View File

@ -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
// }

View File

@ -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
// }