This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Socket read problem on Windows XP Pro & Cygwin
On Oct 22 07:06, Todd Rearick wrote:
> while(1)
> {
> char buf[80];
> int len;
>
> len = recv(infd,buf,1,0);
>
> if (len < 1)
> {
> printf("len = %d\n",len);
> printf("errno = %d\n",errno);
> printf("This means %s\n", strerror(errno));
> sleep(1);
What you're entirely missing at this point is the fact that a return
value of 0 (zero) indicates EOF. You don't test for this. Instead
you're also testing errno in case of EOF, which has no meaning in this
case.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat, Inc.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/