ta lawrence ..

did you get that to work on your server side??
if so maybe its a m$IIS problem (which i am forced to run off)  .. 
because that code hangs here too
cheers

brendan


Lawrence Sheed wrote:

> Have you tried setting socket blocking?
> Here's what I do...
> 
> var $connection=0; 
> $host = "pericles.ipaustralia.gov.au";
> $port=23;
> 
> switch( $connection=fsockopen($host,$port) )   { 
>    case -3: 
>     return("-3 socket could not be created"); 
>    case -4: 
>     return("-4 dns lookup on host '$host' failed"); 
>    case -5: 
>     return("-5 connection refused or timed out"); 
>    case -6: 
>     return("-6 fdopen() call failed"); 
>    case -7: 
>     return("-7 setvbuf() call failed"); 
>    default: 
>       //let getline do its job bit by bit rather than timeout by timeout
> ;)
>       set_socket_blocking ($connection,false);
>   } 
> 
> Function GetLine() {
>       global $debug,$connection;
>       $line = fread($connection,128);
>       while(empty($line)){            
>               $line = fread($connection,128);
>               usleep(250000);         
>       }
> 
>       //If debugging on, force output
>       if ($debug) {
>               print ($line) ."<br>";
>               System("echo ''"); 
>               flush;
>       }
> 
>       return ($line);
> }
> 
> 
> print GetLine();
> 
> -----Original Message-----
> From: brendan [mailto:[EMAIL PROTECTED]]
> Sent: December 19, 2001 1:04 PM
> To: [EMAIL PROTECTED]; James Cox
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] telneting sockets help..
> 
> 
> hi james,
> thanks for your reply  ..
> i was able to connect ( i should have written that in the email) its 
> getting the info to flush to the screen that i cant do .. it just hangs..
> 
> so if you add
> something like
> 
> while (!feof($fp)) {
>          echo fgets ($fp,128);
>      }
>      fclose ($fp);
> 
> to the end
> you get nothing..
> 
> ...
> herein lies my second sleepless day..
> i have been tyring to use the sockets() functions which have been 
> added.. but they are badly documented and extremely unfriendly..
> 
> how did you manage to interact with your telnet server?
> cheers
> brendan
> 
> 
> James Cox wrote:
> 
> 
>>Hi,
>>
>>I had recent problems like this, and I traced it to firewall issues;
>>
> however
> 
>>i just checked the destination, and  found it is possible to telnet to
>>
> that
> 
>>port, so it's not a firewall issue on their side.
>>
>>Try using the following code -- and let it run, see what response you get.
>>
>><?php
>>
>>$host = "pericles.ipaustralia.gov.au";
>>
>>$fp = fsockopen($host, 23, &$errno, &$errstr, 5);
>>   if (!($fp)) {
>>      echo "SOCKET ERROR: $errno - $errstr<br>\n";
>>}
>>
>>?>
>>
>>Hope that helps,
>>
>>James Cox
>>
>>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>>James Cox :: Senior Support Engineer
>>Wherewithal, Inc. e: [EMAIL PROTECTED]
>>Wherewithal. Capture Creative Connections.
>>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>>
>>
>>>-----Original Message-----
>>>From: brendan [mailto:[EMAIL PROTECTED]]
>>>Sent: 19 December 2001 04:12 AM
>>>To: [EMAIL PROTECTED]
>>>Subject: [PHP] telneting sockets help..
>>>
>>>
>>>hi
>>>
>>>i have been trying to write a telnet client to a tn3270 IBM mainframe
>>>database ( pericles.ipaustralia.gov.au:23 ) using fsockopen ...
>>>i thought it wouldnt be that bad given i have done something similar
>>>with usenet ..
>>>however i cannot get it to work no matter what I do .. i just get a
>>>permanent hang ...
>>>has anyone ever attempted this or have any solutions?
>>>
>>>i know this is rather open ended but i cant offer any code which even
>>>kind of works..
>>>
>>>it would be much appreciated..
>>>
>>>
>>>--
>>>PHP General Mailing List (http://www.php.net/)
>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>For additional commands, e-mail: [EMAIL PROTECTED]
>>>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to