实战-球球大作战-运行结果

服务配置

runconfig.lua

return {
  --cluster
  cluster={
    node1 = "127.0.0.1:7771",
    node2 = "127.0.0.1:7772",
  },
  --agentmgr
  agentmgr = { node="node1" },
  --scene
  scene = {
    node1 = {1001,1002},
    node2 = {1003}
  },
  --node1
  node1 = {
    gateway={
      [1]={port=8001},
      [2]={port=8002},
    },
    login={
      [1]={},
      [2]={},
    },
  },
  --node2
  node2={
    gateway={
     [1]={port=8011},
     [2]={port=8022},
    },
    login={
     [1]={},
     [2]={},
    },
  },
}

config.node1

--必须配置
thread = 8                          --启用多少个工作线程
cpath = "../skynet/cservice/?.so"           --用C编写的服务模块的位置
bootstrap = "snlua bootstrap"       --(固定)启动的第一个服务

--bootstrap配置项
start = "main"                      --主服务入口
harbor = 0                          --(固定)不使用主从节点模式

--lua配置项(暂时固定)
lualoader = "./skynet/lualib/loader.lua"
luaservice = "./service/?.lua;".."./service/?/init.lua;".."./skynet/service/?.lua;".."./skynet/service/?/init.lua;"
lua_path = "./etc/?.lua;".."./lualib/?.lua;".."./lualib/?/init.lua;".."./skynet/lualib/?.lua;" .. "./skynet/lualib/?/init.lua"
lua_cpath = "./skynet/luaclib/?.so"

--后台模式(必要时开启)
--daemon = "./skynet.pid"
--logger = "./userlog"

--节点
node="node1"

config.node2

--必须配置
thread = 8                          --启用多少个工作线程
cpath = "../skynet/cservice/?.so"           --用C编写的服务模块的位置
bootstrap = "snlua bootstrap"       --(固定)启动的第一个服务

--bootstrap配置项
start = "main"                      --主服务入口
harbor = 0                          --(固定)不使用主从节点模式

--lua配置项(暂时固定)
lualoader = "./skynet/lualib/loader.lua"
luaservice = "./service/?.lua;".."./service/?/init.lua;".."./skynet/service/?.lua;".."./skynet/service/?/init.lua;"
lua_path = "./etc/?.lua;".."./lualib/?.lua;".."./lualib/?/init.lua;".."./skynet/lualib/?.lua;" .. "./skynet/lualib/?/init.lua"
lua_cpath = "./skynet/luaclib/?.so"

--后台模式(必要时开启)
--daemon = "./skynet.pid"
--logger = "./userlog"

--节点
node="node2"

 

启动节点1

/home/bbb_fight# ./skynet/skynet ./etc/config.node1

启动节点2

/home/bbb_fight# ./skynet/skynet ./etc/config.node2

客户端A

root@server-VirtualBox:/home/server# telnet 127.0.0.1 8001
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
login,100,123
login,0,login success
enter
enter,100,64,48,2
balllist,64,48,2
foodlist,1,65,12,2,53,61
addfood,3,50,15
addfood,4,0,19
addfood,5,1,51
addfood,6,8,50
addfood,7,70,6
addfood,8,2,80

客户端B

root@server-VirtualBox:/home/bbb_fight/service/scene# telnet 127.0.0.1 8011
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
login,101,123
login,0,login success
enter
enter,101,95,55,2
balllist,95,55,2
foodlist,1,46,47,2,7,1,3,92,43
addfood,4,19,82
addfood,5,40,81
addfood,6,63,97
addfood,7,66,8
addfood,8,20,54

 

 测试截图

posted @ 2024-03-29 16:19  独一无二~  阅读(35)  评论(0)    收藏  举报