fixed more tutorial line numbers
@@ -161,7 +161,7 @@ when certain events occur. We will use that next to tell which function we
want NEAT to call when a client connects:
``` embed:: language::c
-../examples/minimal_server.c:55-56
+../examples/minimal_server.c:63-66
```
The function `on_connected` has not been defined yet, we will do that later.
@@ -169,7 +169,7 @@ Now that we have told NEAT what to do with a connecting client, we are ready
to accept incoming connections.
``` embed:: language::c
-../examples/minimal_server.c:58-61
+../examples/minimal_server.c:67-71
```
This will instruct NEAT to start listening to incoming connections on port 5000.
@@ -181,7 +181,7 @@ The last function call we will do in main will be the one that starts the
show:
``` embed:: language::c
-../examples/minimal_server.c:63-66
+../examples/minimal_server.c:72-73
```
When this function is called, NEAT will start doing work behind the scenes.
@@ -191,7 +191,7 @@ also possible to run NEAT without having NEAT capture the main loop. Our final
main function looks like this:
``` embed:: language::c
-../examples/minimal_server.c:44-66
+../examples/minimal_server.c:52-76
```
We have now filled in the main function of our server application. It is time
@@ -199,7 +199,7 @@ to start working on the callbacks that NEAT will use. The first callback we
need is `on_connected`.
``` embed:: language::c
-../examples/minimal_server.c:33-35
+../examples/minimal_server.c:42-44
```
From the functional description above, we know that we need to write to
@@ -209,32 +209,32 @@ use to update the active callbacks of the flow. We set the `on_writable`
callback so that we can start writing when the flow becomes writable:
``` embed:: language::c
-../examples/minimal_server.c:36-36
+../examples/minimal_server.c:45-45
```
It is also good practice to set the `on_all_written` callback when setting the
`on_writable` callback:
``` embed:: language::c
-../examples/minimal_server.c:37-37
+../examples/minimal_server.c:46-46
```
The change is applied by calling `neat_set_operations`, just as in the main function:
``` embed:: language::c
-../examples/minimal_server.c:38-41
+../examples/minimal_server.c:47-47
```
Next, we write the `on_writable` callback:
``` embed:: language::c
-../examples/minimal_server.c:19-21
+../examples/minimal_server.c:27-29
```
Here, we call the function that will send our message:
``` embed:: language::c
-../examples/minimal_server.c:22-24
+../examples/minimal_server.c:30-32
```
Here we specify the data to send and the length of the data.
@@ -245,13 +245,13 @@ pass `NULL` and `0`.
The final callback we need to implement is the `on_all_written` callback:
``` embed:: language::c
-../examples/minimal_server.c:26-28
+../examples/minimal_server.c:35-37
```
Here, we call `neat_close` to close the flow:
``` embed:: language::c
-../examples/minimal_server.c:29-31
+../examples/minimal_server.c:38-38
```
This is the final piece of our server. You may now compile and run the server.
