[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

[no subject]


Thanks for helping me out. I am yet to use poll. But I
am still having
problem with select. In the following code both the
FD_ISSET macro is
returning 1 for both the calls to select even before
data has arrived on
them ! So the recvfrom calls are proceeding
sequentially and until data
arrives in the recvfrom call it is blocking.

      maxfd1 = max(sockfd1,sockfd2) + 1;
      printf("\n sokcfd1 status =
      printf("\n sokcfd 2 status =

      if(status = FD_ISSET(sockfd1,&set))
        count = recvfrom(sockfd1,(char
sockaddr *)&client,&addrlen);
         printf("\n %s",buff1);

         if(status = FD_ISSET(sockfd2,&set))
        count = recvfrom(sockfd2,(char
*)buff2,sizeof(buff2),0, (struct
sockaddr *)&client,&addrlen);
         printf("\n %s ",buff2);

So i decided to make the recvfrom call non-blocking by
using the flag
MSG_DONTWAIT flag option. and i changed the code for
both the sockets as
follows :

count = recvfrom(sockfd2,(char
*)buff2,sizeof(buff2),MSG_DONTWAIT, (struct
sockaddr *)&client,&addrlen);
 if(errno != EWOULDBLCOK)
         printf("\n %s ",buff2);

but in this case both the sockets are not accepting
data from their
respective buffers. I am still not able to identiful
the problem. Could you
please help me out. I am refering Unix Network
Programming by Richard
Stevens, edition 2.


Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/