Files
cworker/README.md
2023-08-19 11:39:01 +02:00

57 lines
2.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## Cworker mini framework
A minimalist kit for creating a network or local service
using only C (replacing a previously written and lost one).
Purpose: to create system services
Available:
* cflexer/cfparser - configuration file parsing
* cllexer/clparser - parsing command line options
* jlexer/jparser - json parsing (minimal key-value for now)
* rcache - buffered reading from open descriptor
* cworker - network service framework
## Cworker mini framework
Минималисткий набор для создания сетевого или локального сервиса
с использованием только C (взамен ранее написанного и утерянного).
Цель: создание системных сервисов, для которых использование
иных языков нерационально или невозможно.
В наличии:
* cflexer/cfparser - разбор конфигурационого файла
* cllexer/clparser - разбор опций коммандной строки
* jlexer/jparser - разбор json описания (пока минимальные key-value)
* rcache - буферизованное чтение из открытого дескриптора
* cworker - каркас сетевого сервиса
В разработке.
## Mini RPC example
```
$ echo '{"name":"john"}' | nc 127.0.0.1 9002
{"message":"hello, john!","error":false}
```
## Log output example
```
./cworker --port=9002 --nofork=true
2023-08-19T11:32:10.370258433+EET debug: Init service
2023-08-19T11:32:10.370280138+EET debug: Configuration reading
2023-08-19T11:32:10.370319130+EET debug: Reading options
2023-08-19T11:32:10.370328274+EET debug: Listening port: 9002
2023-08-19T11:32:10.370332182+EET debug: Service building
2023-08-19T11:32:10.370359884+EET debug: Service running
2023-08-19T11:32:16.691927462+EET debug: Service 4699 forked
2023-08-19T11:32:16.692127033+EET warning: Cannot bind id
2023-08-19T11:32:16.692477102+EET debug: Handler 4699 done
2023-08-19T11:32:32.59611040+EET debug: Service 4704 forked
2023-08-19T11:32:32.59758420+EET warning: Cannot bind id
2023-08-19T11:32:32.60009124+EET debug: Handler 4704 done
```