Giter VIP home page Giter VIP logo

tinynl's Introduction

Travis Status

a tiny network library - one-loop-per-thread reactor model


An implementation inspired by 《Linux多线程服务端编程》 .


Demonstrations are in tests folders of net and base module. chargen, daytime, echo, pingpong, filesrvr, etc.


When I wrote chatter on netty, I learnt something about usage but the design was a black box. Tried debug through the initial process, but that just told me what does it do. Some parts started to make sense when I read the book. So I decide to implement a similar one. But not inventing a new one. I find it is so hard to answer the question 'what's the difference between yours and muduo?' in a short and brief way.

Model is the same.
Model is the most important part of this kind of network library.
Model is why reactor is pervasively used.

When I wrote tinyNL, I logged some thoughts in comments. But I did not write a document which intends to demonstrate something. If you can vividly recall the chapters in that book, differences will be obvious, I think. But if not, I'd say that major divergence is formed by how to deal with closing. And this can be seen in commit logs, too. So git diff is kind of source for answers.
So I think maybe I should log some answers to questions like why certain mechanism is needed in the future. Issues are welcome.

Features

  • 'app' directory resides one application for now. It has a runnable docker image.
  • 'embedlua' directory resides integration of lua script which servers as bussiness logic processing. Handler is able to invoke lua script. And 'send' function is callable in lua script. This is a prototype.

NO codec bundled with this library

  • codec is simply a string processing job other than the real function of network library
  • netty's codec can be a helpful example. this(a chat service) can be a reference.
  • codec can be built by chaining handlers as a pipeline i.e. read length first and then convert the data
  • protobuf can be a useful tool to do serialization/deserialization
  • I will not add codec for a long long time.

tinynl's People

Contributors

nov11 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

bighunter513

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.