Page 1 of 1

developing chat server by PHP

Posted: Mon Jul 08, 2002 4:38 am
by blueriver
any body can tell me if I can develope a chat server by PHP ?
Im new to PHP.

irc chat server?

Posted: Mon Jul 08, 2002 4:51 am
by saryon
heh, if you're new, i don't suggest you go into one of the tougher regions of php ;)

For one, it's quite hard to get PHP to actually do something with sockets, and then
to get it to use it in such a way that you can use it unthreaded even though there are
lots of people connected to your irc server.
Also, since PHP isn't the fastest scripting language around (hell..most scripting languages are
as slow as driving an old lada up a hill), it's not really advantagious to use PHP for this.
If you are looking at it as a way to try out the sockets capability of PHP, try looking
around on the net on how to use sockets, and go check out the post i sent in earlier
on "php networking". (should be down only a few rows).

The best way, it seems to me, is to make a little loop that alternatively reads from sockets,
writes to sockets, and then checks for new connections.
THere's one major problem though....when reading from sockets, php tends to wait till it
gets input, and then go on with the code. But if you don't block the socket, the script
will run wild, and use 100% for as long as the script runs ;)
good luck with this ;)

Posted: Mon Jul 08, 2002 9:04 am
by llimllib
yeah, the whole 'no threads' thing really limits what you can do. a Java applet would be better suited to what it sounds like you want to do. Although, if you still want to go through with trying it, saryon here's your man to talk to :D

Thanks

Posted: Mon Jul 08, 2002 10:47 pm
by blueriver
Thank you very much for your advice. Could u tell me any Website about chat technology & how to develop a chat server?

Posted: Mon Jul 08, 2002 10:55 pm
by llimllib
I suggest you google it.

Posted: Tue Jul 09, 2002 3:29 am
by saryon
simple google search:

http://rfc.net/rfc1459.html


This is the RFC for IRC servers, the de-facto standard sheet on how to create
a irc server.
the complete protocol explanation should be in there.

good luck........

VERY VERY USEFUL!!!!!!!!!!!!!

Posted: Tue Jul 09, 2002 8:26 am
by saryon
VERY VERY USEFUL!!!!!!!!!!!!!

http://marc.theaimsgroup.com/?l=php-dev ... 202033&w=2



just found this site......READ IT.....it's VERY good (the code that is)