| 1 |
/* sktpoll: this program illustrates sleep-polls for clients */ |
| 2 |
#include <stdio.h> |
| 3 |
#include "xtdio.h" |
| 4 |
#include "sockets.h" |
| 5 |
|
| 6 |
/* --------------------------------------------------------------------- */ |
| 7 |
|
| 8 |
/* main: begin here */ |
| 9 |
#ifdef __PROTOTYPE__ |
| 10 |
int main( |
| 11 |
int argc, |
| 12 |
char **argv) |
| 13 |
#else /* __PROTOTYPE__ */ |
| 14 |
int main(argc,argv) |
| 15 |
int argc; |
| 16 |
char **argv; |
| 17 |
#endif /* __PROTOTYPE__ */ |
| 18 |
{ |
| 19 |
Socket *client=NULL; |
| 20 |
|
| 21 |
client= Sopenv("sktpoll","c","SKTPATH"); |
| 22 |
|
| 23 |
while(!client) { |
| 24 |
sleep(1); |
| 25 |
client= Sopenv("sktpoll","c","SKTPATH"); |
| 26 |
} |
| 27 |
|
| 28 |
Sputs("hello",client); |
| 29 |
|
| 30 |
Sclose(client); |
| 31 |
} |
| 32 |
|
| 33 |
/* --------------------------------------------------------------------- */ |
| 34 |
|