Code Monkey home page Code Monkey logo

kcpuv's Issues

無法運行

cmake之後,用VS2015打開,重新生成,產生一大堆無法解析的外部命令

kcp的心跳检测有问题?

看到alive()的调用在conn.cpp:176行,Conn::run()里调用的。
这个只有在收到数据的时候才会被触发。

如果是只发送数据,不接收数据,就会超时出错。

探讨一下框架结构

我一直在用libuv做开发
本来很想尝试改下然后嵌入到我们的项目。但是发现框架影响太大了。

不知道是不是我没太理解清楚还是别的原因

个人感觉应该实现应该只提供好连接管理就行了,不要在上面再做一层libuv的封装。
如果再做一层libuv的封装,把uv_run都隐藏了,这样对其他已有libuv的项目来说结构影响太大?

个人觉得理想的方式是:

服务器:

uv_loop *loop;
kcpuv_server_init(loop, kcp_server);
kcpuv_bind(kcp_server , addr);
kcpuv_listen(kcp_server);
kcpuv_server_start(kcp_server , on_peer_connect_handle);

void on_peer_connect_handle(kcp_server) {
        kcp_client  *peer = kcpuv_peer_init(loop);
        kcpuv_accept(kcp_server, peer);
        kcpuv_start_read(peer, on_data_handle);
}

客户端:

kcpuv_client_init(loop, kcp_client);
kcpuv_connect(kcp_client, addr);
kcpuv_client_start(kcp_server , on_client_connect_handle);

void on_client_connect_handle(kcp_client) {
        kcpuv_start_read(kcp_client, on_read_handle);
}

另外,libuv本身是C89,我觉得如果是要做这种封装,最好也是用C89

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.