#ifndef _SERVER_H_ #define _SERVER_H_ #include "coc_util.h" struct CocClient { struct CocClient *next; int fd; int mode; char cmd[80]; char res[80]; }; int CocInitServer(int bufsize, int port); int CocHandleRequests(int tmo_msec, int fd); int CocHandle1Request(int tmo_msec, int fd); /* handle hetwork requests. return value: <0: error =0: timeout =1: event on fd =2: variable was changed =3: other network request treated CocHandle1Request handles only one network request For CocHandleRequests: if fd=0: returns when a network request has changed a variable, or when timeout has expired (result is 0 or 2) if fd>0: returns when an read event is pending on fd or when timeout has expired (result is 0 or 1) */ struct CocClient *CocGetNextCmd(void); /* get next client with a pending command */ void CocCloseServer(void); #endif /* _SERVER_H_ */