PR_Poll function
Andy Gocke <[email protected]> Sat, 13 Jun 2009 17:12:43 -0500
| Newsgroups | gmane.comp.mozilla.devel.nspr |
|---|---|
| Message-ID | <[email protected]> |
I have a question about the operation of the PR_Poll function. Unlike the Unix socket API, NSPR seems to use an array of file descriptors, instead of a set (fd_set). This presents me with a number of problems, most notably how to keep a list of all current socket connections in my program. Unlike a set, if I remove a socket from the array, it would seem like I would have to move everything else in the array to account for the missing slot. The way out of this would be for the function to keep searching through the array until the number of sockets in the array (second parameter) are all accounted for. This would allow me to create an array of max socket numbers and then leave empty slots in the array when I close one. The simplest way to describe this is a basic free list (malloc) or garbage collection system. My question is basically, how did you guys plan on people using the NSPR API to deal with socket arrays? Did you intend for the user to have to restructure the array constantly? Andy