Mail Archives: cygwin/1999/08/20/18:16:14
Actually, I do not mean to be in any way offensive, or anything like
that. I have been investigating the problem, and have not found
resolution. I would like to emphasize 'seems'. I am a big time linux
user, and I beleive in free software. I also understand the
development process, and that occasionally somone misunderstands an
API, etc.
I am writing a little udp library to do some dirtywork for my other
interests. It's simply job is to send, receive, and listen for data
on a given port. I am writing it to be relativley flexible, but
targetted to basic UDP communications.
This code allows me to do that. In the example have a single socket
open, and am waiting for data to come in on it. The following are a
couple snippets. The code is availible @:
http://www.cyberhighway.net/~iwpsrci/sockets/code.tar Inside are the
gzip'd files. [yes I know, tar the files, and gzip the tar] Oh well,
the code works find on Linux, however, it does not work on cygwin.
The timing in select() is perfect, and it seems normal however, one
question remains. When I was trying to learn about select() I found
the two differing explainations, in differnt man pages:
<snip> Man page 1:<snip>
int select(int numfds, fd_set *readfds, fd_set *writefds , fd_set
*exceptfds, struct timeval * timeout);
<snip> ^^^^^^
This leads me to beleive that I put the number of fd's that I have in
select()
However, this is from the most recent man pages that I have found:
<snip> Man Page 2:<snip>
int select(int n, fd_set *readfds, fd_set *writefds, fd_set
*exceptfds, struct timeval *timeout);
[.....]
n is the highest-numbered descriptor in any of the three
sets, plus 1.
<snip>
This could be my problem, but still.... select() IS working under
Linux 2.2
Just for info, here is me structure, so you know what's up.
.<snip>..
typedef struct
{
int fd;
struct sockaddr_in sa, sout, sinlast;
struct timeval tv;
fd_set fds;
int max_bufsize;
} SOCKET_TYPE;
.<snip>..
here is the routing that calls select:
.<snip>..
int socket_listen (SOCKET_TYPE * st, struct timeval *tv){
struct timeval t_tv;
if (tv==NULL)
tv=&t_tv;
memcpy(tv, &(st->tv), sizeof(struct timeval));
return select ((st->fd + 1), &(st->fds), NULL, NULL, tv);
}
.<snip>..
This returns '0' everytime. If I remove select I can get the data, or
at least, a udp comm utility that I wrote will get the data.
thanks,
Joshua
Chris Faylor wrote:
>
> On Fri, Aug 20, 1999 at 01:51:41PM -0600, joshua M. Schmidlkofer wrote:
> >I am looking for more information with using select(), and cygwin32.
> >So far select() seems completely broken, at least for read fd's.. Did
> >I miss a 'to be developed' page?
>
> Perhaps if you provided more information than "completely broken"
> somebody *might* be able to answer this question.
>
> -chris
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
- Raw text -