WAFer is a C language-based software platform for scalable server-side and networking applications. Think node.js for C programmers.


Build Status


WAFer is a C language-based ultra-light scalable server-side web applications framework. Think node.js for C programmers. Because it's written in C for the C eco system, WAFer is wafer-thins with a memory footprint that is only a fraction of that of node.js and other bulky frameworks.

Just copy server.c (say, as myserver.c), put your code inside the function void server(Request request) in myserver.c and, make with make SERVER=myserver, and you are good to go.

WAFer can operate in many different configurations, all selected at compile time. They include:

  1. Single-threaded (Default) or multi-threaded (make with THREADS=n where n>0)

  2. Select(Default) or epoll (make with LOOP=epoll) based event loop

  3. C10K mode (make with LOOP=epoll MAX_CON_CONS=n where n>10,000)

Default port is 4242. Set environment variable 'PORT' to change it.

That's really it. The source comes with a simple example example.c to get you started.

Note to Contributors

Thank you for making this a wonderful project!

Here's our preferred formatting style:

find . \( -name '*.c' -o -name '*.h' \) -exec indent --no-tabs  --linux-style --line-length 90 --indent-level 4 -bli0 \{\} \;


  1. J. David Blackstone and Feng Shen, whose web servers have been repurposed to build this platform.

  2. Mark Karpeles for the incredible number of bug fixes!

  3. Fine folks at /r/programming for the honest and constructive feedback.

  • Who needs a web framework written under GPL terms anyway

    Who needs a web framework written under GPL terms anyway

    Writing web applications in C is a great idea. Still, people who want to write their own app using C can't legally do it without opening their sources. That's because you distribute it under GPL terms as a set of source files which should be extended by users to get their functionality:

    2. You may modify your copy or copies of the Program or any portion
    of it, thus forming a work based on the Program, and copy and
    distribute such modifications or work under the terms of Section 1
    above, provided that you also meet all of these conditions:
        a) You must cause the modified files to carry prominent notices
        stating that you changed the files and the date of any change.
        b) You must cause any work that you distribute or publish, that in
        whole or in part contains or is derived from the Program or any
        part thereof, to be licensed as a whole at no charge to all third
        parties under the terms of this License.
        c) If the modified program normally reads commands interactively
        when run, you must cause it, when started running for such
        interactive use in the most ordinary way, to print or display an
        announcement including an appropriate copyright notice and a
        notice that there is no warranty (or else, saying that you provide
        a warranty) and that users may redistribute the program under
        these conditions, and telling the user how to view a copy of this
        License.  (Exception: if the Program itself is interactive but
        does not normally print such an announcement, your work based 

    It would be more appropriate to license it under dual MIT/GPL license so people could use your framework without opening the application source code.

    opened by yanalunaterra 5
  • Is there a standard function to handle 404?

    Is there a standard function to handle 404?

    an alternative solution might be

    void server(Request request)
        int is_404 = 0;
        is_404 |= nope_route(request, "/factor", &factor, true);
        is_404 |= something else...
    void handler_404(Request request)
    opened by ly0 2
  • resolve memory leak due to duplicating strings

    resolve memory leak due to duplicating strings

    resolve memory leak due to duplicating strings and not freeing them.

    Also replaced dupstr() with strdup()

    Actually using a static buffer in the calling function would probably be even better

    opened by MagicalTux 2
  • Private caching, POST content data, source file directory

    Private caching, POST content data, source file directory

    This pull request actually implements several different changes I made.

    The first, and simplest, is moving the source code files and headers into the src/ directory and object files into the obj/ directory.

    The second allows to parse data from the POST requests as the request's "contentData".

    The last one implements caching and Last-Modified header support for the serveFile() function.

    If accepting such a pull request is too difficult, I may split it into several if so necessary.

    opened by usrshare 1
  • Fix double close bug when using serveFile api

    Fix double close bug when using serveFile api

    Wrote a small service to serve static content using this method. Closing the write handle here leads to double close bugs later on. It's unnecessary given the wrapping framework.

    opened by wulfen 1
  • Integer overflow in array allocations

    Integer overflow in array allocations

    malloc(n * size) is an antipattern as n * size can overflow (especially from an attacker). You'll want to use calloc or create your own malloc_array function. Something like the following could work:

    static inline void * malloc_array(size_t nmemb, size_t size)
        /* Make the check so that a constant size deletes the zero check
         * and the division.
        if (size != 0u && SIZE_MAX / size < nmemb) {
            errno = ENOMEM;
            return NULL;
        return malloc(size * nmemb);
    opened by mstewartgallus 1
  • Method to set response Mimetype

    Method to set response Mimetype

    Perhaps not an issue, may be my short sightedness. Is there any way to set the mimetype of the response. I would like to use nope.c to produce small rest servers serving simple dynamic json. i would like to be able to set response mimetype as "application/json", based on the response.

    opened by thawkins 1
  • improved makefile, fixed some warnings and removed linking on pthread (unused)

    improved makefile, fixed some warnings and removed linking on pthread (unused)

    Made makefile look slightly better, building nope.c as a static library (libnope.a), and added the ability to have multiple samples (variable "MODULES" in the makefile) compiled. Additionally if you develop your own module (ex. foobar.c) in nope.c's main directory, you can then type "make foobar" to get your source compiled against nope.c.

    Also removed -pthread parameter since only fork() is being used (ie. no threads right now).

    Finally fixed some warnings in nope.c and nopeutils.c

    opened by MagicalTux 1
  • Completion of error handling

    Completion of error handling

    opened by elfring 0
  • README needs info on size of WAFer

    README needs info on size of WAFer

    WAFer is: ultra-light ... wafer-thin

    Can you be more specific in the README? We would like to see approximate LOC, size in memory, size on disk. (compared with node.js etc.)

    opened by ahazred8 0
  • Some clean up

    Some clean up

    notify_parent() is not used in your curent version and timespec is not used too. Could you clean this up? The way you called getnameinfo without checking its failure mode is a bit confusing to me.

    opened by janus 0
  • AF-Unix


    I was a bit confused while going through your code particularly when I noticed that socket used "AF-Unix" . Why using it? I also noticed that now you have epoll, thread, and select. I fcntl and thread, but what do you again with epoll

    opened by janus 1
  • Load Test Failed

    Load Test Failed

    I carried out a load test for nope example.

    ./wrk -t1 -c1 -d10s http://localhost:4242/factor

    The config is: NOPE_EPOLL, NOPE_THREAD 2 The bug looks like this:

    GET /factorGET /factorGET /factorGET /factorGET /factorGET /factorGET /factorGET /factorGET .... /factorGET /factorGEclose: Bad file descriptor
    opened by truongminh 3
  • v0.0.4-alpha(Aug 15, 2014)

Riolet Corporation
Riolet Corporation
RakNet is a cross platform, open source, C++ networking engine for game programmers.

RakNet 4.081 Copyright (c) 2014, Oculus VR, Inc. Package notes The Help directory contains index.html, which is full help documentation in HTML format

Facebook Archive 3.1k Dec 30, 2022
LAppS - Lua Application Server for micro-services with default communication over WebSockets. The fastest and most vertically scalable WebSockets server implementation ever. Low latency C++ <-> Lua stack roundtrip.

LAppS - Lua Application Server This is an attempt to provide very easy to use Lua Application Server working over WebSockets protocol (RFC 6455). LApp

null 48 Oct 13, 2022
High performance server-side application framework

Seastar Introduction SeaStar is an event-driven framework allowing you to write non-blocking, asynchronous code in a relatively straightforward manner

ScyllaDB 7.1k Jan 7, 2023
Mongoose Embedded Web Server Library - a multi-protocol embedded networking library with TCP/UDP, HTTP, WebSocket, MQTT built-in protocols, async DNS resolver, and non-blocking API.

Mongoose - Embedded Web Server / Embedded Networking Library Mongoose is a networking library for C/C++. It implements event-driven non-blocking APIs

Cesanta Software 9k Jan 1, 2023
Small and fast cross-platform networking library, with support for messaging, IPv6, HTTP, SSL and WebSocket.

frnetlib Frnetlib, is a cross-platform, small and fast networking library written in C++. There are no library dependencies (unless you want to use SS

Fred Nicolson 23 Nov 25, 2022
The C++ Network Library Project -- cross-platform, standards compliant networking library.

C++ Network Library Modern C++ network programming libraries. Join us on Slack: http://slack.cpp-netlib.org/ Subscribe to the mailing list: https://gr

C++ Network Library 1.9k Dec 27, 2022
Rudimentary opinionated client-side lua libwayland bindings and scanner

wau This should work with Lua 5.3+. By default it builds with 5.3 instead of 5.4 because the examples depend on lgi. These aren't 1-to-1 bindings to l

null 4 Nov 19, 2022
Side-channel file transfer between independent VM executed on the same physical host

Inter-process or cross-VM data exchange via CPU load modulation What is this I made this PoC as a visual aid for an online discussion about M1RACLES -

Pavel Kirienko 45 Dec 28, 2022
🌱Light and powerful C++ web framework for highly scalable and resource-efficient web application. It's zero-dependency and easy-portable.

Oat++ News Hey, meet the new oatpp version 1.2.5! See the changelog for details. Check out the new oatpp ORM - read more here. Oat++ is a modern Web F

Oat++ 6k Jan 4, 2023
Simple, secure & standards compliant web server for the most demanding of applications

Simple, secure[1] & standards compliant[2] web server for the most demanding[3] of applications. Read more... ?? Optimized security Being meticulously

uNetworking AB 15k Dec 30, 2022
High-level networking API for real-time simulations with primitives for remote procedure call and object state replication

tnl2 - Torque Network Library version 2 tnl2 is a high-level networking API for real-time simulations with primitives for remote procedure call and o

Mark Frohnmayer 23 Apr 10, 2022
C++ Parallel Computing and Asynchronous Networking Engine

As Sogou`s C++ server engine, Sogou C++ Workflow supports almost all back-end C++ online services of Sogou, including all search services, cloud input method,online advertisements, etc., handling more than 10 billion requests every day

Sogou Open Source 9.7k Jan 5, 2023
C++ networking library including UniConf and a convenient D-Bus API

This is wvstreams, a nominally platform-independent networking and utilities library for C++. Some documentation is in the Docs/ directory. If that

null 27 Dec 29, 2021
Socket and Networking Library using msgpack.org[C++11]

netLink C++ 11 KISS principle networking library. Features: C++ 11 IPv4, IPv6 Protocols: TCP, UDP Enable/Disable blocking mode Join/Leave UDP-Multicas

Alexander Meißner 210 Oct 18, 2022
Portable, single-file, protocol-agnostic TCP and UDP socket wrapper, primarily for game networking

Documentation This is a header-only library, as such most of its functional documentation is contained within the "header section" of the source code

null 64 Dec 3, 2022
Simple and small reliable UDP networking library for games

libquicknet Simple and small reliable UDP networking library for games ❗ libquicknet is under development and not suitable for production code ❗ The m

null 25 Oct 26, 2022
mTCP: A Highly Scalable User-level TCP Stack for Multicore Systems

README mTCP is a highly scalable user-level TCP stack for multicore systems. mTCP source code is distributed under the Modified BSD License. For more

null 1.8k Dec 27, 2022
OceanBase Client for C. A driver to connect applications developed in C language to OceanBase Database.

Oceanbase Client for C OceanBase Client for C is a driver used to connect applications developed in C to OceanBase Database Server. Compatibility Serv

OceanBase 22 Nov 8, 2022
A software C library designed to extract data attributes from network packets, server logs, and from structured events in general, in order to make them available for analysis

MMT-DPI A software C library desinged to extract data attributes from network packets, server logs, and from structured events in general, in odrder t

Montimage 3 Nov 9, 2022