multiple using of socket

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nice_n_slow
Forum Newbie
Posts: 2
Joined: Thu Aug 21, 2003 7:55 am

multiple using of socket

Post by nice_n_slow »

i have a question :D

i have script A and script B: i start script A and then start from script A script B

now i connect with a client and want to start script B by giving the socket address to connect script B with the client without disconnect!

i want to start a new php process, therefore i have to start script A with passthru, system, etc.

is that possible ???

thx
User avatar
greenhorn666
Forum Commoner
Posts: 87
Joined: Thu Aug 14, 2003 7:14 am
Location: Brussels, Belgium

Post by greenhorn666 »

Could you be a bit more specific... I must admit that I don't get you!
now i connect with a client and want to start script B by giving the socket address to connect script B with the client without disconnect!
What do you mean?

Process A of script A starts Process B Script B, I got that... Still if A was started by a HTTP request (from who/whatever) and B is started by passthru; I see one socket only.
Anyhow, what if coming after that? you want some client to "take over" the process B of script B using some http socket? right?
Cause that is not possible (by any mean, java, C or whatever I think) since the socket is a link between one IP one port <=> one other IP some port. How could you use the same socket for yet another "socket" ?
To that comes that php is processed based, not thread based, hence you couldn't let some other thread take the socket over...

But again, am I getting you right?
Could you be a bit more explicit?
nice_n_slow
Forum Newbie
Posts: 2
Joined: Thu Aug 21, 2003 7:55 am

Post by nice_n_slow »

okay.. :)

no, i don't want to start process A by HTTP request!

i want to connect the process A with a client and then i start process B from process A and i want to give the connected port of process A to process B!!! a webserver, telnetdeamon etc. do the same thing with childprocesses
how can i do this? with shared memory or something like that ?
i only want to give process B the socket addresse like "Ressource id #1", but not as string :wink:

i hope you can help now
User avatar
greenhorn666
Forum Commoner
Posts: 87
Joined: Thu Aug 14, 2003 7:14 am
Location: Brussels, Belgium

Post by greenhorn666 »

Ok, so you don't want to use the socket on multiple process but delagate to a child process...
Still I don't think that is possible.
First you can't access memory directly in PHP (or do you?)
So that not the way to go...
But why can't Process A not handle it all? What is the purpose of letting A die and B take over?
I am sorry but I can't still get the point here? except if you tell me you code apache in php over again ;)

You could RTFM at
- Process Control Functions
- Sockets

in order to find out more maybe?
Post your answer if you find it! It interests me... I'll lookup too and tell you if I find/make something out
Post Reply