descriptionnone
repository URLhttps://github.com/rofl0r/rocksock.git
ownerretnyg@gmx.net
last changeFri, 25 Mar 2022 22:47:42 +0000 (25 22:47 +0000)
last refreshSat, 27 Apr 2024 11:57:48 +0000 (27 13:57 +0200)
content tags
add:
README.md

rocksock socket library (C) rofl0r

rocksock is a powerful (mostly) blocking networking library written in C. it was designed for small size, robustness, simplicity, static linking and fine-grained error reporting and configurability. programming in a blocking way is much simpler, but can lead to near infinite blocking. rocksock addresses this by providing timeouts so the app doesn't get into a completely blocked state and can react properly on any exceptional condition. making the app fit for SSL only requires enabling one flag, and SOCKS/HTTP proxy support is built-in as well.

build:

for a "default" build, for example for a distribution, just use ./configure && make as usual.

advanced/customized build using RcB:

write your app, include the rocksock header using a relative pathname, and then use the build tool rcb on your main C file, supplying all config options as CFLAGS. rcb will then automatically find all required translation units and throw them at once at the compiler, giving perfect opportunities for link-time optimization.

typical tree structure:

myapp/
rocksock/
lib/ (libulz)

myapp/main.c:

/* tiny program to see if a specific port on a specific host
   is open for usage in shellscripts or similar. */
#include "../rocksock/rocksock.h"
#include <stdio.h>
#include <stdlib.h>

static void usage(void) {
        dprintf(2, "usage: prog ip port\n");
        exit(1);
}

int main(int argc, char** argv) {
        if(argc != 3) usage();
        rocksock s;
        rocksock_init(&s);
        rocksock_set_timeout(&s, 5000);
        int ret = rocksock_connect(&s, argv[1], atoi(argv[2]), 0);
        rocksock_clear(&s);
        return ret;
}
$ cd myapp
$ CFLAGS="-DUSE_SSL -flto -O3 -s -static" rcb main.c
shortlog
2022-03-25 rofl0rexamples/portscanner: quick hack to make it work on... master
2021-04-15 rofl0radd LGPL 2.1 license
2019-04-21 rofl0rrocksock_add_proxy_fromstring: look for @ from the...
2019-04-10 rofl0radd support for RcB2 build system
2019-01-06 rofl0rfix spurious omitted sys error return value
2019-01-03 rofl0radd proxychain example
2019-01-03 rofl0rrocksock_ssl_internal.h: properly document CFLAGS for...
2019-01-03 rofl0radd rocksock_strerror_detailed()
2019-01-03 rofl0rchange which proxy as reported as being failing
2018-12-20 rofl0ralways close socket automatically when connection fails
2018-03-27 rofl0rMakefile: build 2 more examples
2018-03-27 rofl0radd proxychk example
2017-01-29 rofl0rssh-socks-restart: make test server list user-define...
2017-01-29 rofl0rrocksock_ssl_internal.h: include correct (renamed)...
2017-01-26 rofl0rssh-socks-restart example: factor out cfg_gotosection
2017-01-20 rofl0radd rocksockirc wrapper
...
heads
2 years ago master
6 years ago win32