php-windows Digest 2 Jan 2003 21:59:49 -0000 Issue 1515

Topics (messages 17615 through 17620):

Re: Subject: UDP packet
        17615 by: Neil Smith
        17618 by: Torben Dehn

NEW COM
        17616 by: Christopher Davis
        17617 by: Luis Ferro

FastCGI support
        17619 by: Fernando Serboncini
        17620 by: Christoph Grottolo

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message --- Since you are getting some data back from the server when connecting in this manner, everything seems to be okay. However - remember that UDP is a connectionless protocol (unlike TCP which has a form of packet accounting), you may not *necessarily* get all the packets delivered which may impact finding an EOF sequence.

You may need to set a socket timeout value (use socket_set_timeout() or stream_set_timeout() with something reasonable, say 1 second) which continues the script if no more data is being received. Read more about this here :

http://www.php.net/manual/en/function.fsockopen.php and
http://www.php.net/manual/en/function.socket-set-timeout.php

I have also verified that some versions of PHP (<4.2) will hang up a script (up to the script timeout) if a packet request is blocked by a firewall on the other end.

You can read more about this in a bug report submitted in February.
http://bugs.php.net/bug.php?id=15639

Hope it works out.

Regards,
Neil Smith.

At 08:04 02/01/2003 +0000, you wrote:
Message-ID: <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Reply-To: "Torben Dehn" <[EMAIL PROTECTED]>
From: "Torben Dehn" <[EMAIL PROTECTED]>
Date: Wed, 1 Jan 2003 17:34:05 +0100
Subject: UDP packet

Hello !

I am very new to PHP so please don't laugh if my code really sucks ;=)

What i am trying to do is :

1) Opening an UDP connectión to a server (That works allright)
2) Making a query to the server (That works allright)
3) Recieve an unknow number of UDP packets with an unknown packet size (This
is my problem)

I don't know the packet size and i don't know how many packets the server
will return...
Take a look at the WHILE loop because thats where it "hangs".
If i remove the WHILE loop and just make a fread($socket,1024) it will
return some data.

My questions  are as follow :
1) How can i make sure that ALL data has been recieved ?
2) Is it possible to read each UDP packet into it's own variable (array) ???

I would be very happy if someone could answer one or all question.


<?
$ip      = "192.246.40.65";
$port    = 27950;
$command = "˙˙˙˙getservers 60 empty full";
$data    = '';

Echo "Connecting to Master Server : $ip:$port<br>";
$socket = fsockopen("udp://$ip",$port,$errno,$errstr,2);
if (!$socket)
 {
   echo "There was an error connecting to the Master Server<br>";
   echo "Error returned was : $errorno and $errostr";
   exit;
 }  //Socket error
 else
 {
   echo "Connection established ..<br>";
   If (!fwrite($socket,$command))
  {
    echo "There was an error querying the master server ..";
    exit;
  } //Fwrite error
 echo "Query complete ..<br>";

while (!feof($socket))
 {
    echo "Reading data ..<br>";
    $data .= fread($socket,4096);
  }  //End of read section

  echo "$data<br>";

   fclose($socket);
   echo "Connection closed ..<br>";
 } //End of main loop

?>

--- End Message ---
--- Begin Message ---
HI Niel and thanks for your answer...i will look into it.
Maybe it's a stupid question but can't i read one packet at a time and put i
into it's own variable?
or is it just a stream of data that stops when there is no more data to send
?

(I better go read something about UDP packets 8) )

I hope this understand what i am saying.
"Neil Smith" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Since you are getting some data back from the server when connecting in
this manner, everything seems to be okay. However - remember that UDP is a
connectionless protocol (unlike TCP which has a form of packet accounting),
you may not *necessarily* get all the packets delivered which may impact
finding an EOF sequence.

You may need to set a socket timeout value (use socket_set_timeout() or
stream_set_timeout() with something reasonable, say 1 second) which
continues the script if no more data is being received. Read more about
this here :

http://www.php.net/manual/en/function.fsockopen.php and
http://www.php.net/manual/en/function.socket-set-timeout.php

I have also verified that some versions of PHP (<4.2) will hang up a script
(up to the script timeout) if a packet request is blocked by a firewall on
the other end.

You can read more about this in a bug report submitted in February.
http://bugs.php.net/bug.php?id=15639

Hope it works out.

Regards,
Neil Smith.

At 08:04 02/01/2003 +0000, you wrote:
>Message-ID: <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Reply-To: "Torben Dehn" <[EMAIL PROTECTED]>
>From: "Torben Dehn" <[EMAIL PROTECTED]>
>Date: Wed, 1 Jan 2003 17:34:05 +0100
>Subject: UDP packet
>
>Hello !
>
>I am very new to PHP so please don't laugh if my code really sucks ;=)
>
>What i am trying to do is :
>
>1) Opening an UDP connectión to a server (That works allright)
>2) Making a query to the server (That works allright)
>3) Recieve an unknow number of UDP packets with an unknown packet size
(This
>is my problem)
>
>I don't know the packet size and i don't know how many packets the server
>will return...
>Take a look at the WHILE loop because thats where it "hangs".
>If i remove the WHILE loop and just make a fread($socket,1024) it will
>return some data.
>
>My questions  are as follow :
>1) How can i make sure that ALL data has been recieved ?
>2) Is it possible to read each UDP packet into it's own variable (array)
???
>
>I would be very happy if someone could answer one or all question.
>
>
><?
>$ip      = "192.246.40.65";
>$port    = 27950;
>$command = "˙˙˙˙getservers 60 empty full";
>$data    = '';
>
>Echo "Connecting to Master Server : $ip:$port<br>";
>$socket = fsockopen("udp://$ip",$port,$errno,$errstr,2);
>if (!$socket)
>  {
>    echo "There was an error connecting to the Master Server<br>";
>    echo "Error returned was : $errorno and $errostr";
>    exit;
>  }  //Socket error
>  else
>  {
>    echo "Connection established ..<br>";
>    If (!fwrite($socket,$command))
>   {
>     echo "There was an error querying the master server ..";
>     exit;
>   } //Fwrite error
>  echo "Query complete ..<br>";
>
>while (!feof($socket))
>  {
>     echo "Reading data ..<br>";
>     $data .= fread($socket,4096);
>   }  //End of read section
>
>   echo "$data<br>";
>
>    fclose($socket);
>    echo "Connection closed ..<br>";
>  } //End of main loop
>
>?>


--- End Message ---
--- Begin Message ---
I have created a COM DLL which works fine from VB, VB SCRIPT, ASP, VFP.  But
it crash when i try

<?
$instance=new com("comtest.test")
?>

Any ideas ?

The object is created which Visual Foxpro V7

Thanks



--- End Message ---
--- Begin Message ---
Apart from the usual:

<?
$instance=new com("comtest.test"); // added the ;
?>

Luis Ferro



Christopher Davis wrote:

I have created a COM DLL which works fine from VB, VB SCRIPT, ASP, VFP. But
it crash when i try

<?
$instance=new com("comtest.test")
?>

Any ideas ?

The object is created which Visual Foxpro V7

Thanks






---
[This E-mail scanned for viruses by Declude Virus]

--- End Message ---
--- Begin Message ---
Hi,

obviously, I don't know if this is the right newsgroup to ask such
questions, but
here it goes...

what has happened with FastCGI support on the 4.3 version of PHP?
On changelog I saw that SAPI/FastCGI was discontinued.

But when I do phpinfo() it reports "Server API : CGI/FastCGI"

and when I go with "php -v" the answer is:
PHP 4.3.0 (cgi-fcgi), Copyright (c) 1997-2002 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies

and when I go with "php -h" there's an option :
  -b <address:port>|<port> Bind Path for external FASTCGI Server mode

But when I do "php -b localhost:5000" it says there's no "b" command.

What's up with FastCGI? Was it really discontinued?

If so, where can I find good alternatives to FastCGI for my home made
webserver running on WinXP and
where can I find the reasons that lead to this?

thankz
Fernando


--- End Message ---
--- Begin Message ---
Fernando Serboncini wrote:
> Hi,
>
> obviously, I don't know if this is the right newsgroup to ask such
> questions, but
> here it goes...
>
> what has happened with FastCGI support on the 4.3 version of PHP?
> On changelog I saw that SAPI/FastCGI was discontinued.
>
> But when I do phpinfo() it reports "Server API : CGI/FastCGI"

Look for postings by Shane Caraveo on php.dev. He's been working on FastCGI
support.

Christoph


--- End Message ---

Reply via email to