• Stars
    star
    164
  • Rank 230,114 (Top 5 %)
  • Language
    C
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A C network library
znet - a simple C network library
---------------------------------

This library is inspired by Yawei Zhang's ZsummerX[1] library, but this one is
a pure C version. Now it implement a IOCP (IO Completion Port) backend on
Windows, and a epoll backend on Linux, a kqueue backend on BSD and Mac OS X
systems, and select backend for others.

The ZNet library itself is a single-header library[2], and have some utils
single-header libraries for common usages. all liraries are standalone and can
used without other headers.

See test.c for examples, and you can see more things in examples folder.

Utils:

zn_buffer.h: mainly based the luaL_Buffer in Lua code. But the interface is
targeted by send/recv method, so it's very useful to make znet send data
continually and receive packets by packets.

zn_deque.h: a double-direct pipe implement that can be used a queue or stack
cross threads. it implements block API like push/pop from deque, and non-block
API to fetch the front and back items from deque.

zn_task.h: a task thread pool implement. you can create a task pool and post
tasks to pool, task will run in other thread, you can use zn_deque.h to notice
original thread the completion of tasks.

The znet library and utils have the same license when Lua[3], have fun :)


[1]: https://github.com/zsummer/zsummerX
[2]: https://github.com/nothings/stb
[3]: https://www.lua.org/license.html

More Repositories

1

lua-protobuf

A Lua module to work with Google protobuf
Lua
1,727
star
2

luautf8

a utf-8 support module for Lua and LuaJIT.
C
405
star
3

amoeba

a Cassowary constraint solving algorithm implements in pure C.
C++
176
star
4

loki

loki - the lightweight online game framework
C
96
star
5

luaiter

A iteration library for Lua
Lua
55
star
6

lpath

a OS specified path manipulation module for Lua
Lua
44
star
7

lua-fmt

A fmtlib implement for Lua
Lua
37
star
8

luagbk

GBK encoding string support for Lua programming language.
C++
32
star
9

lua-nanovg

Lua bindings for nanovg.
C
32
star
10

lbuffer

a mutable string support to lua.
C
24
star
11

luasched

A C coroutine scheduler for Lua
C
22
star
12

lbind

A LuaNativeObject like lua binding generator
C
22
star
13

lua-miniz

Lua module for miniz support
C
15
star
14

lua-physfs

physfs binding for Lua.
C
11
star
15

vimrc

my vim configurations
Vim Script
7
star
16

luabuild

scripts for build Lua on Windows.
C
7
star
17

nui

the Native cell-structured UI framework
C
7
star
18

kit

a simple type system
C
6
star
19

lmapm

A complete arbitrary precision library for Lua based on MAPM.
C
6
star
20

lua-mp

yet another msgpack implement for Lua
Lua
5
star
21

lunzip

A Lua module that use minizip to read zip file
C
4
star
22

dotfiles

my dot files
Shell
4
star
23

VimE

Vim Extensible -- rehash Vim sources into a new frame.
C
4
star
24

lon

the Lua Object Notation
C
2
star
25

lnode

a tree model bridge between C/C++ and Lua
C
2
star
26

ssm

Super SnipMate! A new snippet auto-complete plugin for Vim
Vim Script
2
star
27

replxx

A readline and libedit replacement that supports UTF-8, syntax highlighting, hints and Windows and is BSD licensed.
C++
1
star
28

kitten

the kitten language
1
star
29

tokentools

a C lexer framework
C
1
star