aboutsummaryrefslogtreecommitdiffstats
path: root/README
blob: fe21a01ef227c999dadaff5060d7826144835ce5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# nserver

A nihilistic stats server written as part of reading Learn C the Hard
Way.

It's a toy, bugs galore.

## compiling

You'll need a C compiler (clang or gcc), the [gdbm][1] library and
[GNU make][2].

[1]: https://www.gnu.org.ua/software/gdbm
[2]: https://www.gnu.org/software/make

To compile the server, do:

```
gmake
```

To compile a debuggable version of the server, do:

```
gmake dev
```

The usual:

```
gmake clean
```

to clean up things.

This was written on an OpenBSD machine. There might be issues
compiling this one other systems.

## running

To start this server, do:

```
./bin/nserver
```

It'll be listening on port 7899.

You can connect as a client to the server via `nc`:

```
nc 127.0.0.1 7899
```


### client commands

Recognized commands:


```
/create NAME
/sample NAME
/mean NAME
/dump NAME
/list
/store NAME
/load NAME ANOTHER_NAME
```

The `/store` command stores `NAME` in a persistent database on the disk.

The `/load` command loads the `NAME` from the persistent database into
memory at ANOTHER_NAME.