1 /* example of a simple server that plays a wave file using aplay when
4 #include "../rocksockserver.h"
8 int on_clientconnect (void* userdata
, struct sockaddr_storage
* clientaddr
, int fd
) {
9 rocksockserver
*s
= userdata
;
10 rocksockserver_disconnect_client(s
, fd
);
12 if(!pid
) execl("/bin/sh", "/bin/sh", "-c", "aplay /root/ring.wav", (char*) 0);
13 else waitpid(pid
, 0, 0);
19 char* listenip
= "0.0.0.0";
21 if(rocksockserver_init(&s
, listenip
, port
, &s
)) return -1;
22 if(rocksockserver_loop(&s
, NULL
, 0, &on_clientconnect
, 0, 0, 0)) return -2;