Socket Connections Was: Re: [PHP] Resource type numbers

From: Date: Mon, 11 Nov 2002 19:32:50 +0000
Subject: Socket Connections Was: Re: [PHP] Resource type numbers
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-123867@lists.php.net to get a copy of this message
Ok, I think I found out why the script Im debbugging is returning an empty string. 1. It opens a socket to the mailserver with fsockopen 2. It checks the greeting by reading using fgets() 3. Then it check the reponse by supplying the username to the fsockopen() connection 4. It returns an empty string. It seems as if the first time fgets() was used on the open connection, it reads it to EOF. Any further attemps would fail because the data from the socket connection is at EOF. I tried to rewind() it, but rewind() doens't take socket resource. So, going by what this script is trying to do, (I have no experience with this), is it correct to assume, that with each attempt to talk to the server, a new connection must be made to read data from it?? If you want more info, feel free to ask... Thanks Gerard Samuel wrote:
Im debugging a script that opens a connection to a pop3 server. When I var dump the return of fsockopen() from the script Im debugging, I get -> resource(38) of type (socket) I made up a dummy script to see what I would get and the return of fsockopen is -> resource(1) of type (socket) My dummy script is able to to recieve a +OK from the pop3 server but the other file is getting an empty string. Is there a difference between 1 and 38?? Thanks... --- Gerard Samuel http://www.trini0.org:81/ http://dev.trini0.org:81/
-- Gerard Samuel http://www.trini0.org:81/ http://dev.trini0.org:81/

« previous php.general (#123867) next »