Page 1 of 1
Multiple user telnet server
Posted: Thu Feb 03, 2005 12:13 am
by jl
To test out an idea, I want to allow multiple telnet clients to connect to my server, and then be able to send broadcast messages to all connected clients from PHP.
It doesn't matter if the server that the user connects to is some other process/server on my Linux box (i.e. not PHP itself), as long as the message can originate from PHP.
Thanks for any ideas
jl
Posted: Thu Feb 03, 2005 12:30 am
by feyd
"broadcast" how?
Posted: Thu Feb 03, 2005 12:35 am
by magicrobotmonkey
you can use php to run any command line command, if you already have something in place to broadcast and you just need a remote interface.
Posted: Thu Feb 03, 2005 12:39 am
by jl
Hello? Is this thing on?
I want to broadcast to all connected clients through a normal tcp connection.
What's a remote interface? What's your suggestion on how to have PHP broadcast to many of them?
Posted: Thu Feb 03, 2005 12:56 am
by feyd
You didn't specify who you want to send the broadcast to other than "clients" Which clients? Web clients? The other telnet clients?
Posted: Thu Feb 03, 2005 1:00 am
by jl
feyd wrote:You didn't specify who you want to send the broadcast to other than "clients" Which clients? Web clients? The other telnet clients?
jl wrote:To test out an idea, I want to allow multiple telnet clients to connect to my server, and then be able to send broadcast messages to all connected clients from PHP.
'clients' as used towards the end of the sentence was referring to the same 'clients' mentioned earlier in the same sentence. sorry if that was unclear.
Posted: Thu Feb 03, 2005 6:04 am
by timvw
quite easy. write yourself a server program that accepts incoming connections and echoes all incoming messages back to all the clients. (most books i've read had examples that are called multiserver.java)
in php you can also connect to that server with fsockopen. and then you can read/write from/into that socket just like you would do with a file.... i love that unix 'everything-is-a-file(stream)' approach

Posted: Thu Feb 03, 2005 6:12 am
by jl
tim, just found something which does exactly that (in Perl

) and I can fsockopen to it from php. works nicely, other than it being in Perl
http://poe.perl.org/?POE_Cookbook/Chat_Server