新增tcpsocket协议

This commit is contained in:
duanhf2012
2020-01-20 13:26:50 +08:00
parent f824fddcad
commit c3cb6ff977
4 changed files with 261 additions and 2 deletions

View File

@@ -10,7 +10,8 @@
"ServiceList": [
"HttpServerService",
"SubNet1_Service",
"SubNet1_Service1"
"SubNet1_Service1",
"TcpSocketPbService"
],
"ClusterNode":["SubNet2.N_Node1","N_Node2"]
},

View File

@@ -3,9 +3,28 @@ package main
import (
"github.com/duanhf2012/origin/cluster"
"github.com/duanhf2012/origin/originnode"
"github.com/duanhf2012/origin/sysservice"
"github.com/duanhf2012/origin/sysservice/originhttp"
"github.com/duanhf2012/origin/network"
)
type TcpSocketServerReciver struct {
}
func (slf *TcpSocketServerReciver) OnConnected(pClient *network.SClient){
}
func (slf *TcpSocketServerReciver) OnDisconnect(pClient *network.SClient){
}
func (slf *TcpSocketServerReciver) OnRecvMsg(pClient *network.SClient, pPack *network.MsgBasePack){
}
func main() {
node := originnode.NewOriginNode()
@@ -18,9 +37,11 @@ func main() {
for _, ca := range nodeCfg.CAFile {
httpserver.SetHttps(ca.CertFile, ca.KeyFile)
}
pTcpService := sysservice.NewTcpSocketPbService(":9004",&TcpSocketServerReciver{})
httpserver.SetPrintRequestTime(true)
node.SetupService(httpserver)
node.SetupService(httpserver,pTcpService)
node.Init()
node.Start()
}