Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问我按照readme里面运行服务报错 #37

Open
ciaos opened this issue Dec 13, 2019 · 1 comment
Open

请问我按照readme里面运行服务报错 #37

ciaos opened this issue Dec 13, 2019 · 1 comment

Comments

@ciaos
Copy link

ciaos commented Dec 13, 2019

[root@server ]$ go run main.go server.go
go: finding github.com/aceld/zinx/ziface latest
go: finding github.com/aceld/zinx latest
go: finding github.com/aceld/zinx/znet latest
go: downloading github.com/aceld/zinx v0.0.0-20191210110905-0a663b2d6b15
go: extracting github.com/aceld/zinx v0.0.0-20191210110905-0a663b2d6b15
build command-line-arguments: cannot load zinx/utils: cannot find module providing package zinx/utils

package main

import (
"github.com/aceld/zinx/znet"
)

func main() {
//1 创建一个server句柄
s := znet.NewServer()

//2 配置路由
s.AddRouter(0, &PingRouter{})

//3 开启服务
s.Serve()

}

package main

import (
"fmt"

"github.com/aceld/zinx/ziface"
"github.com/aceld/zinx/znet"

)

type PingRouter struct {
znet.BaseRouter
}

func (this *PingRouter) Handle(request ziface.IRequest) {
fmt.Println("recv from client : msgId=", request.GetMsgID(), ", data=", string(request.GetData()))

err := request.GetConnection().SendBuffMsg(0, []byte("ping...ping...ping"))
if err != nil {
	fmt.Println(err)
}

}

@adsian
Copy link
Collaborator

adsian commented Feb 22, 2020

go run server.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants