Multiple user telnet server

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
jl
Forum Commoner
Posts: 53
Joined: Tue Nov 09, 2004 12:05 am

Multiple user telnet server

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

"broadcast" how?
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post 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.
jl
Forum Commoner
Posts: 53
Joined: Tue Nov 09, 2004 12:05 am

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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?
jl
Forum Commoner
Posts: 53
Joined: Tue Nov 09, 2004 12:05 am

Post 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.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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 :)
jl
Forum Commoner
Posts: 53
Joined: Tue Nov 09, 2004 12:05 am

Post by jl »

tim, just found something which does exactly that (in Perl :roll: ) and I can fsockopen to it from php. works nicely, other than it being in Perl ;-)

http://poe.perl.org/?POE_Cookbook/Chat_Server
Post Reply