Don't know if this will help, but can you confirm whether your while loop is
failing on the first time through or a subsequent time through (perhaps by
echoing something each time through)?

Warren Vail


-----Original Message-----
From: René Fournier [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 13, 2004 5:13 PM
To: Vail, Warren
Cc: php
Subject: Re: [PHP] Why would a socket be unavailable?


Hi Warren,

There is only one process, and I'm sure I have only one IP address. 
It's just one script that loops. At the top of the loop, it waits to 
socket_read some data. If no data appears, I want it to timeout so that 
it can send the server a ping (which I must do). THAT is where the 
problem starts. If I don't bother making the socket_read timeout, the 
loop works beautifully-it just waits and waits at socket_read, and then 
when data appears, it does its thing, then goes back to the top of the 
loop and waits again. It's when I set the timeout option, and then it 
DOES actually time out (because there is no data for several seconds), 
that it no longer is able to socket_read data from the connection.

.Rene

On Thursday, May 13, 2004, at 05:57 PM, Vail, Warren wrote:

> So you have two processes running, one which is waiting on the socket 
> connection and another, which we have seen, to establish the 
> connection.
>
> Doesn't sound to me to be related to performing blocked/non-blocked 
> connections.
>
> What are the odds that you have multiple IP addresses on your machine?
>  Can
> you confirm that both of your processes are using the same IP address 
> (or
> the ip address of the other process)?
>
> Warren Vail
>
>
> -----Original Message-----
> From: René Fournier [mailto:[EMAIL PROTECTED]
> Sent: Thursday, May 13, 2004 4:49 PM
> To: Vail, Warren
> Cc: php
> Subject: Re: [PHP] Why would a socket be unavailable?
>
>
> There is no firewall-it's all running locally, on my iBook (with 
> Firewall off). You know, I really wish it WAS the firewall. :-) I 
> really can't believe this little problem I'm encountering is because
> of some bug in the Socket library. I mean, what I'm doing is so simple,
> and I'm sure hundreds of other PHP programmers have done this before,
> like, a million times. The whole script is actually very simple:
>
> Enter loop
>       If data is received, handle it
>       If data is not received in several seconds, send server a ping
>
> .Rene
>
> On Thursday, May 13, 2004, at 05:40 PM, Vail, Warren wrote:
>
>> There is another kind of blocking you could be running into (other 
>> than the type mentioned in the manual) and it was eluded to before.  
>> What are the
>> odds you are going through a firewall to get to the server.  Firewalls
>> will
>> reject attempts to connect to unauthorized sockets on protected
>> machines.
>>
>> Warren Vail
>>
>>
>> -----Original Message-----
>> From: René Fournier [mailto:[EMAIL PROTECTED]
>> Sent: Thursday, May 13, 2004 4:24 PM
>> To: [EMAIL PROTECTED]
>> Cc: php
>> Subject: Re: [PHP] Why would a socket be unavailable?
>>
>>
>> On Thursday, May 13, 2004, at 05:13 PM, Daniel Clark wrote:
>>
>>> http://www.php.net/manual/en/ref.sockets.ph
>>
>> Yes, I've read that page... many times. It has not helped me. That is 
>> why I am posting my problem here, in that hopes that someone can 
>> help.
>>
>> (I don't mean to be completely helpless, but I just don't yet 
>> understand blocking/non-blocking sockets, and the parameters 
>> associated, since they are not well-documented. Someone said I 
>> shouldn't complain about this-and I'm not-since the functions are 
>> marked  "Experimental". But this is precisely why I'm posting the 
>> question here.)
>>
>> .Rene
>>
>>
>>>> I just read something about sock warnings this morning.   It said
>>>> sometimes they drop off, and to ignore the warnings, but capture 
>>>> the errors.
>>>>
>>>>> I get this output:
>>>>>
>>>>> PHP Warning:  socket_read() unable to read from socket [35]: 
>>>>> Resource temporarily unavailable in 
>>>>> /Users/rene/Sites/gpspolice/titan/cr.php
>>>>> on
>>>>> line 63
>>>>>
>>>>>  From this code:
>>>>>
>>>>> do {
>>>>>   socket_set_block($socket);
>>>>>   socket_set_option($socket,SOL_SOCKET,SO_RCVTIMEO,$timeout);
>>>>>   while(($buf = socket_read($socket,128,PHP_BINARY_READ)) !== 
>>>>> false) {
>>>>>
>>>>>   [...]
>>>>>
>>>>> And it's failing at "while". Any ideas?
>>>>>
>>>>> ...Rene
>>>
>>>
>>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to