示例#1
0
文件: server.go 项目: shaladdle/goaaw
func NewServer(root string, l net.Listener) (*Server, error) {
	srv := &Server{
		stdfs:  std.New(root),
		rpcSrv: rpc.NewServer(),
	}

	srv.rpcSrv.Register("RemoteFS", srv)
	go srv.rpcSrv.Accept(l)

	return srv, nil
}
示例#2
0
文件: server.go 项目: shaladdle/goaaw
func NewTCPServer(root, hostport string) (*Server, error) {
	srv := &Server{
		stdfs:  std.New(root),
		rpcSrv: rpc.NewServer(),
	}

	srv.rpcSrv.Register("RemoteFS", srv)
	srv.rpcSrv.TCPListen(hostport)

	return srv, nil
}
示例#3
0
文件: server.go 项目: shaladdle/goaaw
func NewServer(hostport, root string) (*Server, error) {
	s := &Server{
		srv:    newServer(root),
		rpcSrv: rpc.NewServer(),
	}

	err := s.rpcSrv.Register("SyncServer", s.srv)
	if err != nil {
		return nil, err
	}

	l, err := net.Listen("tcp", hostport)
	if err != nil {
		return nil, err
	}

	go s.rpcSrv.Accept(l)

	return s, nil
}