note 108929 added to function.pfsockopen

From: Date: Wed, 06 Jun 2012 12:17:23 +0000
Subject: note 108929 added to function.pfsockopen
Groups: php.notes 
Request: Send a blank email to php-notes+get-188416@lists.php.net to get a copy of this message
pfsockopen() works great on IIS/Windows7 installation, it keeps connection open which is good for performance. However, there is one caveat: when connection is broken because of physical net failure, pfsockopen() returns handle as if connection was working. Subsequent call to fwrite() returns false so you have information about error. The problem is that after physical net connection is restored the situation doesn't change: pfsockopen() still returns handle and fwrite() returns false. In other words, PHP sticks to old connection that is not working (if you use fsockopen() instead, it will connect properly). Situation goes back to normal after 30 minutes when PHP closes unused connection. The solution to this problem is to call fclose() on socket handle when fwrite() returns false. ---- Server IP: 69.147.83.197 Probable Submitter: 83.15.236.226 ---- Manual Page -- http://www.php.net/manual/en/function.pfsockopen.php Edit -- https://master.php.net/note/edit/108929 Del: integrated -- https://master.php.net/note/delete/108929/integrated Del: useless -- https://master.php.net/note/delete/108929/useless Del: bad code -- https://master.php.net/note/delete/108929/bad+code Del: spam -- https://master.php.net/note/delete/108929/spam Del: non-english -- https://master.php.net/note/delete/108929/non-english Del: in docs -- https://master.php.net/note/delete/108929/in+docs Del: other reasons-- https://master.php.net/note/delete/108929 Reject -- https://master.php.net/note/reject/108929 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#188416) next »