12345678910111213141516171819202122232425262728293031 |
- #include <stdio.h>
- #include "fester.h"
- // on windows compile with -lws2_32
- int main() {
-
- struct client * storage;
-
- // does something dumb for Msft
- __STARTUP();
-
- // get a server socket from the Operating system
- int sock = setup();
-
- // allocate memory for storage for the life of the application
- if(NULL == (storage = allocateBunnies(sock))) {
- fprintf(stderr, "not enough memory for program to run\n");
- return 0;
- }
-
- /* run the main loop as often as possible, in this example there is
- * nothing else to do, so there is just an infinite loop where
- * normally a different program might do something else
- */
- while(1) {
- // technically this is a sleep, milliseconds is for how long
- somethingNeedDoing(1000 /* milliseconds */, storage);
- }
-
- }
|