Re: fsockopen help!
| From: | TaoX { Brian Hinson; } | Date: | Fri, 25 Aug 2000 04:50:06 +0000 |
| Subject: | Re: fsockopen help! | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-13576@lists.php.net to get a copy of this message | ||
The problem with fgets is that it either
- reads until eof... not suitable for network protocols
- reads until length has been reached... also not known
- reads until \n, also a major problem
hence you have to use fgetc or fread with length one... and read byte by
byte to construct a full line... then parse the line for codes/data whatever
is required of the protocol.
TaoX
----- Original Message -----
From: "Joseph H Blythe" <joe.blythe@binarylogic.com.au>
To: "TaoX { Brian Hinson; }" <brianh@rjsonline.net>
Cc: "Brian B." <dreamboy@aros.net>; <php-general@lists.php.net>
Sent: Friday, August 25, 2000 12:04 AM
Subject: Re: [PHP] fsockopen help!
> "TaoX { Brian Hinson; }" wrote:
>
> > This is possible solely with PHP... though it will take a little
programming
> > and knowledge of whatever protocol you are programming for... for
instance..
> > first you need to set blocking if you want functions to wait for data if
> > there is none. Next you need to write get line functions for your
protocol
> > as php fgets and others won't work, or atleast I can't get them to work
and
> > thats because say for instance the smtp protocol... each line end with
CRLF
> > control-linefeed.. so I write a get line that reads until these two
chars
> > are detected and then I parse the line and send back replies accordingly
and
> > wait for responses....
> >
> > Hope this helps.
> > TaoX
>
> > > Regards,
> > >
> > > Jsoeph
> >
>
> This problem has got me so messed ot that I can't even spell my own name
> anymore LOL :-)
>
> Can anyone help me write a alternate function for fgets in php? I haven't
got a
> clue where to start, fgets should be able to handle what im trying to do
as its
> only TCP and the packets im sending are plain ASCII text, I don't
understand
> what the big deal is?
>
> Regards
>
> Joseph
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>