Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Signed-off-by: Glenn Fiedler <[email protected]>
  • Loading branch information
gafferongames authored Dec 27, 2023
1 parent 4f8bcf5 commit c05cc30
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,32 @@ if ( endpoint == NULL )
}
```
Next, create a function to send packets:
```c
static void transmit_packet( void * context, uint64_t id, uint16_t sequence, uint8_t * packet_data, int packet_bytes )
{
(void) context; // void* pointer that you can set via config
(void) id; // uint64_t client id. set this to anything you want in config
(void) sequence; // sequence number of packet being sent
(void) packet_data; // the packet data
(void) packet_bytes; // size of the packet in bytes
// send packet using sockets
}
```

And a function to process received packets:

```c
static int process_packet( void * context, uint64_t id, uint16_t sequence, uint8_t * packet_data, int packet_bytes )
{
// read the packet here and process its contents, return 0 if the packet should not be acked

return 1;
}
```
# Author
The author of this library is Glenn Fiedler.
Expand Down

0 comments on commit c05cc30

Please sign in to comment.