SNL (Simple Network Layer)

Download
Demo Code
Changes

SNL is a very user friendly library to hide all complicated things about network programming behind a neat C api. It starts the threads on incoming connections, sends and receives data over a socket and takes care of large enough buffers. This way, a buffer overflow is definitely impossible to happen, as long as only library functions are used to read from and write to the socket filedescriptors.

The biggest difference between SNL and other network libraries is its somehow "asynchronous" design. You don't have to call a read() function, that will block until data appears on the network socket, but you register a callback function, that will get called as soon, as data has been received. Thereby, the buffer for the currently read data will always be big enough to store the received datagram as its size is transported within the SNL packet header. As a bonus, your read callback function, will only get called, when the datagram has been read completely.

Since Version 1.2.0 i have added support for Pike. The SNL package contains a snl.pmod Module now, which is compatible to the c library. The API is nearly the same, so i wouldn't expect any difficulties here.

I've planned to add C++ wrappers and an OO-Pike module soon, so you may check back from time to time.