Aadhavan Srinivasan 5df38a4e97 | 2 years ago | |
---|---|---|
docs/man3 | 2 years ago | |
.gitignore | 2 years ago | |
Makefile | 2 years ago | |
README.md | 2 years ago | |
easysock.c | 2 years ago | |
easysock.h | 2 years ago |
README.md
An easy-to-use C socket library
Easysock is a single-file, easy-to-use socket library, that can be used for network programming in C. It has no dependencies other than the C standard library.
Compiling
The library can be compiled using the provided Makefile.
make
There are a few optional targets, which enable specific functionality.
allwarn - enable all warnings
debug - compile with 'debug' flag
static - compile as statically linked library - NOT IMPLEMENTED
They can be used as follows:
make [TARGET NAME]
Installation
The library can also be installed using the provided Mekfile.
make install
The install
target supports two environment variables. DESTDIR
, which specifies the installation directory, and PREFIX
which specifies the installation prefix. They can be used as follows:
DESTDIR=/home/user PREFIX=/usr/local make install
This will install the library file in /home/user/usr/local/lib
and the header file in /home/user/usr/local/include
.
Usage
To use the library, simply include the header file:
#include <easysock.h>
...
and link the library:
gcc example.c -o example -leasysock
Troubleshooting
The library isn't loaded on Arch Linux, "cannot open shared object file: No such file or directory"
This is becacuse Arch Linux doesn't include '/usr/local/lib' in its library search path by default. To add it, create a file ending in '.conf' under /etc/ld.so.conf.d/
, and add '/usr/local/lib' to it. Then, run ldconfig
as root.
This file was written using Dillinger.