Hi Jack, Regardless of the portability library that you're using, Windows doesn't allow select() operations on any other than socket handles.
I don't have personal experience how to work around that issue with APR though, I'm sorry. With kind regards, Erik. On Tue, Jun 16, 2009 at 8:42 PM, Jack Andrews<effb...@gmail.com> wrote: > hi, > > i want to detect IO on a child process stdio as well > as a socket from elsewhere. ie. i want a select() > on /windows/. > > is it possible with APR? or do i have to hack around? > > my first attempt is here: > > int main(int c,char** argv) > { apr_procattr_t *attr; > const char*args[]={"cmd.exe",0}; > apr_sockaddr_t *sa; > apr_socket_t *sock; > apr_file_t *fds[4]; > apr_pollfd_t pfd[4],*pfdout; > apr_pollset_t *pollset; > > fds[0]=(apr_file_t*)sock; > AS(apr_procattr_create(&attr, pool)); > AS(apr_procattr_io_set(attr, APR_FULL_BLOCK,APR_FULL_BLOCK,APR_FULL_BLOCK)); > AS(apr_procattr_cmdtype_set(attr, APR_PROGRAM)); > AS(apr_proc_create(&newproc, "c:\\Windows\\system32\\cmd.exe", args, > 0, attr, pool)); > fds[1]=newproc.in;fds[2]=newproc.out;fds[3]=newproc.err; > AS(apr_pollset_create(&pollset, 4, pool, APR_POLLSET_WAKEABLE)); > > #define setpfd(x,a,b,c,d) > pfd[x].desc_type=(a),pfd[x].reqevents=(b),pfd[x].desc.s=(c),pfd[x].client_data=(d) > for(i=0;i<4;i++) > { > setpfd(i,i?APR_POLL_FILE:APR_POLL_SOCKET,APR_POLLIN|APR_POLLOUT|APR_POLLHUP,(apr_socket_t*)fds[i],NULL); > AS(apr_pollset_add(pollset,pfd+i)); > } > for(;APR_TIMEUP==apr_pollset_poll(pollset,0,&n,&pfdout);) > { printf("hoo\n"); > } > return 0; > } > > > > ta, jack. >