We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
[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()
}
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) }
The text was updated successfully, but these errors were encountered:
go run server.go
Sorry, something went wrong.
No branches or pull requests
[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()
}
package main
import (
"fmt"
)
type PingRouter struct {
znet.BaseRouter
}
func (this *PingRouter) Handle(request ziface.IRequest) {
fmt.Println("recv from client : msgId=", request.GetMsgID(), ", data=", string(request.GetData()))
}
The text was updated successfully, but these errors were encountered: