hello every1,
I seed a suggesting related asychron i\o. I'm write a program which use completion ports, but wandor how avoiding loops like for(;below...
i.e I want parse proto with count in first and then computing some quantity of pieces.
how that make with aio?
Code:void parse(void *buf, int buflen, struct sockaddr_in sin){ struct piece { uint32 id[2]; uint32 stuffing[10] }; struct head { int count_of_pieces[2]; struct piece p; }; for(;;){ } } void sig_handler(int signo, siginfo_t *info, void *context ){ int ret; char *buf; struct sockaddr_in sin; struct aiocb *req; if (info->si_signo == SIGIO) { req = (struct aiocb *)info->si_value.sival_ptr; if (aio_error( req ) == 0) { ret = aio_return( req ); (char*)(req->aio_buf+ret); parse(req->aio_buf,ret,sin.sin_addr.s_addr); } } return; }



LinkBack URL
About LinkBacks
below...



