GithubHelp home page GithubHelp logo

skynet_package's Introduction

What's this ?

It's a example to show how to split the packages from a tcp data stream in skynet.

service/socket_proxyd.lua is a manager service of sockets, and lualib/socket_proxy.lua is the library. Read the test/main.lua for usecase.

If you want to manage a tcp data stream, you can call proxy.subscribe(fd) first. It register the fd into the manager (the unique service socket_proxyd) , and launch a C service for it to split the tcp data stream.

proxy.read(fd) would request a package (WORD in big endian + DATA) from the C service.

proxy.write(fd) would forward the package to the tcp socket.

These C services haven't list in debug console, but you can call info by socket_proxyd in debug console to show these services.

Build

Modify the Makefile, change SKYNET_PATH to your path of skynet. The default path is $(HOME)/skynet .

If you are not using linux, make it by yourself.

Test

Run skynet first :

$(HOME)/skynet test/config

And then use the simple client in ./test :

lua test/client.lua

The test/main.lua is a simple echo server, so you can try to type something now.

skynet_package's People

Contributors

cloudwu avatar kinbei avatar sundream avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

skynet_package's Issues

关于网络异常检测的问题

在局域网中测试,发现客户端禁用网络后重连,服务器无法检测网络断线造成每次重连只有等到TIMEOUT后才行.

clientsocket无法找到

看了最新的lua_clientsocket源码,入口函数是luaopen_client_socket,改成local socket = require "client.socket"就好了

连接断开时,package的c服务没有被回收

您好,经过阅读源码发现在收到socket的close或error的消息的时候只是给业务层发送断开消息并处理,但是并没有退出和回收自身的c服务,这里应该要退出吧,不然存在内存泄漏的风险?

关于一个fd是否推荐在多个service中可写

目前只在一个service中读,但由于有client.push的需求,所以想在多个service可以直接push, 这样需要在每个服务都subscribe, 像这种需求是否有推荐更好的做法?

close_agent

你好,云大

skynet_package/service/socket_proxyd.lua的

local function close_agent(addr)
    local fd = assert(socket_addr_fd[addr])
    socket_fd_addr[fd] = nil
end

是不是有问题啊,应该是

local function close_agent(addr)
    local fd = assert(socket_addr_fd[addr])
    socket_fd_addr[fd] = nil
    socket_addr_fd[addr] = nil
end

吧?

关于这种处理方式在cluster模式下的问题

我们的游戏一直都是用这个模式做gate,而且一直都是一台服务器,但由于新的需求需要把gate部分剥离出来,现在有个困扰就是agent部分也要随着gate服务器,但agent中有些游戏逻辑操作,如果把这些游戏逻辑搬到gate感觉有些不妥,如果只是在gate服务器的agent中读取消息再推送的游戏服务器上感觉又和以前的skyent的gate模式一样了。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.