You are here: Re: How to use fgets() with a NNTP server? « PHP Programming Language « IT news, forums, messages
Re: How to use fgets() with a NNTP server?

Posted by test on 12/20/64 11:44

On Fri, 7 Apr 2006 11:57:35 +0200, test wrote:

> Hi,
>
> I am using fgets() to recieve an article from a NNTP server.
> The articles end with:
>
> .
>
> or in other words: <crlf>.<crlf>
>
> My code that reads the article always hangs when it reaches
> the end, and I don't understand why. Can you help me write the
> condition for the while() statement? This is the code:
>
> fputs($soket, "article 91500\n");
> $t = fgets($soket, 1024);
>
> $i=0;
> // OK so far
>
> while ($t != ".") { // this doesn't work, nor does ".\n"
> $i++;
> $sve[$i] = $t;
> $t = fgets($soket, 1024);
> }

It seems that fgets() *waits* for input if there is none. How
can I prevent it? Or is there an alternative function? also, I
should still get to the dot *before* I get to the end of
transmission.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация