Skip to content

flychensc/loquat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

loquat

With the polymorphic and inheritance features of C++, use Epoll to implement TCP server/client, and UDP.

Usage

Epoll is the core of system. All fd(s) Epoll.Join to poll read/write events. The system started working with Epoll.Wait.

Listener is used to implement TCP server. Listener.OnAccept will establish incomming connection by Connection. Connector is used to implement TCP client.

Connector and Connection are a pair of TCP stream, implement OnRecv, OnClose by yourself. Enqueue is used to enqueue output data.

Peer is used to implement UDP application. Implement OnRecv by yourself.

Examples

Refer examples

  1. TCP server and client:

    Echo Server and Echo Client

  2. UDP pairs:

    UDP Server and UDP Client

  3. Chat server:

    Chat Server and Chat Client