netc

A simple C library for opening network sockets using linux syscalls.
git clone git://depsterr.com/git/netc
Log | Files | Refs | README | LICENSE

README.md (873B)


      1 netc
      2 ====
      3 
      4 A simple C library for opening network socket filedescriptors using linux syscalls.
      5 
      6 Functions
      7 ---------
      8 
      9 `netc_open`
     10 To open a socket use `netc_open` which takes two arguments, both of type `const char*`, host and port. The function will then return a normal linux file descriptor. (see `open_example.c`)
     11 
     12 `netc_listen`
     13 Open a listener socket file descriptor that's able to accept connections through the accept syscall. (see `listen_example.c`)
     14 
     15 All functions which can fail may return an error value, to check if a function failed, simply check if it's return value is below zero. If a function failed you may use the `netc_decode_error` to get a string corresponding to the error code.
     16 
     17 Source
     18 ------
     19 
     20 A lot of this code has been taken from other projects, like [quark](https://tools.suckless.org/quark/) by suckless and [irc.c](https://c9x.me/irc/) by c9x.