GithubHelp home page GithubHelp logo

charles-tcppool's Introduction

Charles TCP Pool

Welcome to Charles TCP Pool, it is a simple self-repair tcp connection pool. And it would be very nice to extend it. I will be grateful.

Usage

  • git clone https://github.com/linghuazaii/Charles-TcpPool.git
  • make
  • the shared library will be generated. and also the pool test and the simple test server

Note

  • for CharlesTcpPool::getConnection(timeout), this timeout is the timeout you wait for a valid connection and you can't ignore it, or you can just modify the code. this function will return NULL if it can't give you a valid connection. in this situation, you shouldn't use putConnection() to put this connection back since NULL is not a connection. and even though you get a connection not NULL, when you do write or read you may find that this connection is bad,but don't worry, just putConnection() to return to the pool and wait for some time or continue to try to getConnection() until your job is done. you better wait for some time, since my baby thread will repair the bad connection which might be caused by crashed server or server closes the connection.
  • for TCP_KEEPALIVE, this part is not integrated, you can extend it. some server may close connection if connection is not active for some time. but that's ok, if it is closed then it is repaired. if you use TCP_KEEPALIVE, this version will use system config, you can extend it to use your own KEEPALIVE config in progress scope.
  • there is possibility that if you use blocking io, think about it, client do write then read and some bad server do read, write and then close. if this close packet isn't received by client after client do getConnection write read getConnection(get the same fd, but it is closed) write read, the last read will return 0. and it is your responsibility to handle client/server logic, I ensure you this pool works fine.

charles-tcppool's People

Contributors

thelostpeace avatar desion avatar

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.