views:

23

answers:

1

I'm trying to write a php code that acts as a server. All it would do is connects two socket, it opens a file socket and pipes everything from it into another socket that it connects to. It would run 24/7. I'm not familiar with PHP but this project requires it. Any help?

+4  A: 

Here's a great resource that does exactly what you need:

http://devzone.zend.com/article/1086

An actual answer would be pretty long winded for this Q/A format...

arnorhs
+1 Had the same link; it is indeed a great resource for socket programming.
mathepic
I'm not sure where to start, which socket would I need? It needs to transfer each byte as they come in. Any help please?
erotsppa
@erotsppa: Have you read the article? It seems to cover the basics pretty well. Just read it from the beginning. I would even say the example given is already similar to what you want to do.
Felix Kling
If you don't know PHP in general, you might have some problems with that. The code clearly shows you how to do it. Basically you create a listening socket and a while loop that never terminates that regularly checks the socket if there's incoming data.Which part are you not following?"Which socket"? Well, the one you create. Listening to the port you specify. Have you done socket programming before in another language?
arnorhs