Re: Re: Issue with blocked socket stream

[email protected] ("Phani Raju")
Newsgroups php.general
Message-ID <1265558515.S.3342.37013.f5mail-237-215.rediffmail.com.1265619511.5544@webmail.rediffmail.com>
It was a mistake while copying the code. I had '\n' only.

On Sun, 07 Feb 2010 21:31:55 +0530  wrote
>Phani Raju wrote:

> I am trying to open a blocking stream using fsockopen. I want to write and read XML input/output from a server. After opening the steam I will send a XML request to server using the stream. Once this request is sent, I want to keep listening on the port indefinitely.

> 

> I tried using blocking stream for this with a huge timeout. But had no success as it was not waiting for such a long period.

> 

> Code:

> $parser = xml_parser_create("UTF-8");

> if($stream = @fsockopen($host, $port, $errorno, $errorstr, $timeout)) {

> stream_set_blocking($stream, 1);

> stream_set_timeout($stream, TIMEOUT);

> fwrite($stream, $xml."n");



fwrite($stream, $xml."n") should probably be fwrite($stream, $xml."\n") ?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.