You are here: UNIX Socket does not send data until closed « PHP Programming Language « IT news, forums, messages
UNIX Socket does not send data until closed

Posted by Chris on 07/24/07 16:35

Hi,

I am using PHP persistent sockets and have a problem with them. The
problem is that PHP only sends the data when the socket is closed. In
the code example below the counterparty process (peer) received the
connect request from PHP, but then never receives the message sent in
the "fwrite" command below - and consequently never generates the
reply which should be read by the fgets command.

Flushing the socketFP does not make any difference - the only thing
that causes the data to be sent is to fclose it (which defeats the
purpose of having persistent sockets, which I definitely need).

Any help much appreciated.

System:
PHP version 5.2.0-8+etch7, Debian Linux 2.6.18-4-486

Best regards

------------------ Code Sample -----------------------------------
$SocketFP = pfsockopen("unix:///tmp/hs.socket",0,$errno,$errstr);
if ($SocketFP == FALSE) {
... error handling
}

stream_set_timeout($SocketFP,2);
stream_set_blocking($SocketFP,1);
$Msg = sprintf("ConnectId %d\n\r",$OurId);
$i =fwrite($SocketFP,$Msg);
fflush($SocketFP);

if ($i==FALSE) {
... error handling
}

$message = fgets($SocketFP);

 

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

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