There are no reviews yet. Be the first to send feedback to the community and the maintainers!
Repository Details
Multi-Read from one bind port
A lightweight epoll wrap for read multi-sockets
api
// create a pool , listen on port , set max connection and , buffer size (0 for default 1M bytes)struct mread_pool * mread_create(int port , int max , int buffer);
// release the poolvoidmread_close(struct mread_pool *m);
// poll the poll, timeout (in milliseconds) can be -1 for indefinitely.// return id (which socket can read) , -1 for blockintmread_poll(struct mread_pool *m , int timeout);
// pull data from the id return by poll. // return size of buffer or NULLvoid * mread_pull(struct mread_pool *m , int size);
// When you don't need use the data return by pull, you must call yield// Otherwise, you will get them again after next pollvoidmread_yield(struct mread_pool *m);
// When the id is closed, it returns 1intmread_closed(struct mread_pool *m);
// Close idvoidmread_close_client(struct mread_pool *m, int id);
// Get the socket fd bind with id , you can use it for sending.intmread_socket(struct mread_pool *m , int id);