Re: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processe s

2002-07-22 Thread Evan Nemerson

Either exec(), system(), or one of the functions like them (check the manual) 
doesn't wait for anything to return- it just begins executing a new process 
and sends it on its way. Perhaps you could use this and just make whatever 
you want to do a seperate file?



On Monday 22 July 2002 15:09 pm, David Buerer wrote:
 Yes, that's exactly what I want to do.  But HOW do I do it?

 i.e.  I'm sitting in my accept connectinos loop in the chat daemon

 While(true)
 {
   //waitforenwconnection
   $new_connection_id=socket_accept();

   //got a new connection, go process it
   go_do_this_in_a_new_thread($new_connection_id);
 }

 What do I put in place of go_do_this_in_a_new_thread()

 -Original Message-
 From: Demitrious S. Kelly [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 22, 2002 3:01 PM
 To: 'David Buerer'; [EMAIL PROTECTED]
 Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processes


 Yes. Write a daemon which listens on a socket and manages the
 communications it gets from the satellite scripts and works the database
 for them...

 The scripts send off data, and process replies. They don't do the heavy
 work...

 -Original Message-
 From: David Buerer [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 22, 2002 2:30 PM
 To: '[EMAIL PROTECTED]'
 Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processes

 How to I inovoke a new Thread from the middle of a PHP script?

 -Original Message-
 From: Paul Maine [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 22, 2002 10:08 AM
 To: David Buerer; [EMAIL PROTECTED]
 Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processes


 You can use threads with NT to accomplish what you are asking.

 -Original Message-
 From: David Buerer [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 22, 2002 11:29 AM
 To: '[EMAIL PROTECTED]'
 Subject: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processes


 I've got effectivly a glorified chat server which upon the arrival of a
 message thorugh a socket connection goes off and runs a bunch of database
 processed.  My questions is this:  How can I seperate the database
 processing into a seperate processor process?  I really don't want the chat
 server to have to wait until after the database processing is done to go
 intercept and process another request--this just doesn't seem right.  I
 want the chat server process to be able to deal with getting and receiving
 messages, and another process to deal with the database processing. That
 way if one of the processes get's slow, the other isn't affected. Something
 like the fork command would work really well, but fork doesn't exist in NT.

 Anyone have any ideas?

 I'm running Windows NT4.0 sp6a
 Apache Server 1.3.xx
 MySQL
 and of course, PHP 4.2.1

-- 
Man discovers truth by reason only, not by faith.

Leo Nikolaevich Tolstoy


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




RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processe s

2002-07-22 Thread David Buerer

I thought about this and it's actually not such a bad idea.  I struggle with
it a little though because it seems like kind of a brute force method.  I'll
end up with an awful lot of PHP.EXE processes going at the same time.
Although it would get the job done, I'm not certain that it's the right
solution. I was hoping for something a little more elegant.  I really like
the pcntl_xxx() functions, but they are only available on UNIX platforms.
And no, UNIX is not an option for this client...they are on Windows and
that's where they're going to stay.

Anyone else have any other ideas?

-Original Message-
From: Evan Nemerson [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 22, 2002 3:47 PM
To: David Buerer; [EMAIL PROTECTED]
Subject: Re: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processe s


Either exec(), system(), or one of the functions like them (check the
manual) 
doesn't wait for anything to return- it just begins executing a new process 
and sends it on its way. Perhaps you could use this and just make whatever 
you want to do a seperate file?



On Monday 22 July 2002 15:09 pm, David Buerer wrote:
 Yes, that's exactly what I want to do.  But HOW do I do it?

 i.e.  I'm sitting in my accept connectinos loop in the chat daemon

 While(true)
 {
   //waitforenwconnection
   $new_connection_id=socket_accept();

   //got a new connection, go process it
   go_do_this_in_a_new_thread($new_connection_id);
 }

 What do I put in place of go_do_this_in_a_new_thread()

 -Original Message-
 From: Demitrious S. Kelly [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 22, 2002 3:01 PM
 To: 'David Buerer'; [EMAIL PROTECTED]
 Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate 
 processes


 Yes. Write a daemon which listens on a socket and manages the 
 communications it gets from the satellite scripts and works the 
 database for them...

 The scripts send off data, and process replies. They don't do the 
 heavy work...

 -Original Message-
 From: David Buerer [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 22, 2002 2:30 PM
 To: '[EMAIL PROTECTED]'
 Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate 
 processes

 How to I inovoke a new Thread from the middle of a PHP script?

 -Original Message-
 From: Paul Maine [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 22, 2002 10:08 AM
 To: David Buerer; [EMAIL PROTECTED]
 Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate 
 processes


 You can use threads with NT to accomplish what you are asking.

 -Original Message-
 From: David Buerer [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 22, 2002 11:29 AM
 To: '[EMAIL PROTECTED]'
 Subject: [PHP] Windows NT Server, FORK, SOCKETS, and seperate 
 processes


 I've got effectivly a glorified chat server which upon the arrival of 
 a message thorugh a socket connection goes off and runs a bunch of 
 database processed.  My questions is this:  How can I seperate the 
 database processing into a seperate processor process?  I really don't 
 want the chat server to have to wait until after the database 
 processing is done to go intercept and process another request--this 
 just doesn't seem right.  I want the chat server process to be able to 
 deal with getting and receiving messages, and another process to deal 
 with the database processing. That way if one of the processes get's 
 slow, the other isn't affected. Something like the fork command would 
 work really well, but fork doesn't exist in NT.

 Anyone have any ideas?

 I'm running Windows NT4.0 sp6a
 Apache Server 1.3.xx
 MySQL
 and of course, PHP 4.2.1

-- 
Man discovers truth by reason only, not by faith.

Leo Nikolaevich Tolstoy




Re: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processe s

2002-07-22 Thread Jeremy

That's basically what happens in forking and threading. More PHP.EXE
processes appear, even on *nix.

- Original Message -
From: David Buerer [EMAIL PROTECTED]
To: 'Evan Nemerson' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, July 23, 2002 6:35 AM
Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processe s


 I thought about this and it's actually not such a bad idea.  I struggle
with
 it a little though because it seems like kind of a brute force method.
I'll
 end up with an awful lot of PHP.EXE processes going at the same time.
 Although it would get the job done, I'm not certain that it's the right
 solution. I was hoping for something a little more elegant.  I really like
 the pcntl_xxx() functions, but they are only available on UNIX platforms.
 And no, UNIX is not an option for this client...they are on Windows and
 that's where they're going to stay.

 Anyone else have any other ideas?

 -Original Message-
 From: Evan Nemerson [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 22, 2002 3:47 PM
 To: David Buerer; [EMAIL PROTECTED]
 Subject: Re: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processe
s


 Either exec(), system(), or one of the functions like them (check the
 manual)
 doesn't wait for anything to return- it just begins executing a new
process
 and sends it on its way. Perhaps you could use this and just make whatever
 you want to do a seperate file?



 On Monday 22 July 2002 15:09 pm, David Buerer wrote:
  Yes, that's exactly what I want to do.  But HOW do I do it?
 
  i.e.  I'm sitting in my accept connectinos loop in the chat daemon
 
  While(true)
  {
  //waitforenwconnection
  $new_connection_id=socket_accept();
 
  //got a new connection, go process it
  go_do_this_in_a_new_thread($new_connection_id);
  }
 
  What do I put in place of go_do_this_in_a_new_thread()
 
  -Original Message-
  From: Demitrious S. Kelly [mailto:[EMAIL PROTECTED]]
  Sent: Monday, July 22, 2002 3:01 PM
  To: 'David Buerer'; [EMAIL PROTECTED]
  Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate
  processes
 
 
  Yes. Write a daemon which listens on a socket and manages the
  communications it gets from the satellite scripts and works the
  database for them...
 
  The scripts send off data, and process replies. They don't do the
  heavy work...
 
  -Original Message-
  From: David Buerer [mailto:[EMAIL PROTECTED]]
  Sent: Monday, July 22, 2002 2:30 PM
  To: '[EMAIL PROTECTED]'
  Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate
  processes
 
  How to I inovoke a new Thread from the middle of a PHP script?
 
  -Original Message-
  From: Paul Maine [mailto:[EMAIL PROTECTED]]
  Sent: Monday, July 22, 2002 10:08 AM
  To: David Buerer; [EMAIL PROTECTED]
  Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate
  processes
 
 
  You can use threads with NT to accomplish what you are asking.
 
  -Original Message-
  From: David Buerer [mailto:[EMAIL PROTECTED]]
  Sent: Monday, July 22, 2002 11:29 AM
  To: '[EMAIL PROTECTED]'
  Subject: [PHP] Windows NT Server, FORK, SOCKETS, and seperate
  processes
 
 
  I've got effectivly a glorified chat server which upon the arrival of
  a message thorugh a socket connection goes off and runs a bunch of
  database processed.  My questions is this:  How can I seperate the
  database processing into a seperate processor process?  I really don't
  want the chat server to have to wait until after the database
  processing is done to go intercept and process another request--this
  just doesn't seem right.  I want the chat server process to be able to
  deal with getting and receiving messages, and another process to deal
  with the database processing. That way if one of the processes get's
  slow, the other isn't affected. Something like the fork command would
  work really well, but fork doesn't exist in NT.
 
  Anyone have any ideas?
 
  I'm running Windows NT4.0 sp6a
  Apache Server 1.3.xx
  MySQL
  and of course, PHP 4.2.1

 --
 Man discovers truth by reason only, not by faith.

 Leo Nikolaevich Tolstoy




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




Re: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processe s

2002-07-22 Thread Richard Lynch

Yes, that's exactly what I want to do.  But HOW do I do it?

i.e.  I'm sitting in my accept connectinos loop in the chat daemon

While(true)
{
 //waitforenwconnection
 $new_connection_id=socket_accept();

 //got a new connection, go process it
 go_do_this_in_a_new_thread($new_connection_id);
}

What do I put in place of go_do_this_in_a_new_thread()

Use fsockopen() to talk to your *OTHER* PHP script waiting in a loop to do
the *real* work.

IE, have a *second* PHP file that runs on yet another socket to do the work.


-Original Message-
From: Demitrious S. Kelly [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 22, 2002 3:01 PM
To: 'David Buerer'; [EMAIL PROTECTED]
Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processes


Yes. Write a daemon which listens on a socket and manages the communications
it gets from the satellite scripts and works the database for them...

The scripts send off data, and process replies. They don't do the heavy
work...

-Original Message-
From: David Buerer [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 22, 2002 2:30 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processes

How to I inovoke a new Thread from the middle of a PHP script?

-Original Message-
From: Paul Maine [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 22, 2002 10:08 AM
To: David Buerer; [EMAIL PROTECTED]
Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processes


You can use threads with NT to accomplish what you are asking.

-Original Message-
From: David Buerer [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 22, 2002 11:29 AM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processes


I've got effectivly a glorified chat server which upon the arrival of a
message thorugh a socket connection goes off and runs a bunch of database
processed.  My questions is this:  How can I seperate the database
processing into a seperate processor process?  I really don't want the chat
server to have to wait until after the database processing is done to go
intercept and process another request--this just doesn't seem right.  I want
the chat server process to be able to deal with getting and receiving
messages, and another process to deal with the database processing. That way
if one of the processes get's slow, the other isn't affected. Something like
the fork command would work really well, but fork doesn't exist in NT.

Anyone have any ideas?

I'm running Windows NT4.0 sp6a
Apache Server 1.3.xx
MySQL
and of course, PHP 4.2.1




-- 
Like Music?  http://l-i-e.com/artists.htm


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