PDA

View Full Version : PHP Socekt Server for Flash Chat


jopiruizen
06-08-2006, 03:38 AM
Hi everyone,

1st of all I would like to introduce my self, I'm Jopiruizen.. It's nice to be here in actionscript.org..


Now here's my dilemna. I created a flash chat with php and mysql.. For a while me and my pals(friends,classmates, officemate, relatives) were using it. Now for the sake of speed and technology I would like to redevelop it using PHP socket server but I don't have an IDEA on where to start or what should I do..

I have an enovative WAMP with my PC.. I don't know if it is capable to use socket server..

I look to different PHP tutorial about socket server but I don't understand a bit of it..

I just want to ask for guidance and technical terms about socket server, port, connections.. etc (anything about socket server). and if it is possible I need a detailed explanation about it.. (ex Connnection - is a blah blah blah to make blah blah blah)

Few Questions

1. Does socket server can run on local host?

2. Does a PHP free web host offers a socket server for PHP? (examle JanHost, deluxe host)

3. Will i still use the echo method to fetch data to flash(XML or LoadVars)?


I'll be right here waiting to any of your suggestions, oppinions or any violent reactions..

thanks in advance.

take care and God bless all of us..


jopiruizen

Flash Gordon
06-08-2006, 03:46 AM
I look to different PHP tutorial about socket server but I don't understand a bit of it..No crap! Me either. I wish there was good tut on it. If you find one, please let me know.

With that said, you know you can by a chat application for $5 on the net. It's almost not really worth the time to make it when you can buy it soooo freakin' cheap.

BTW, "Snapple" has some Java and Flash chat scripts in some of his post. May you could use that?
Oh and my guess it you should be using the XMLSocket class for this.

jopiruizen
06-08-2006, 04:02 AM
I just want to learn the ins and out of PHP socket server thing

Flash Gordon
06-08-2006, 04:05 AM
my suggestion is to go to a php forum. Find the answer there for the php part and then combine it with flash. If you ever get a good tut, please let us know.

ybull
06-16-2006, 04:35 PM
Hi,

I haven't done much with PHP Sockets, but I've used Flash with Java sockets several times.

On the server you need permission to "listen" on a particular port. Chances are most hosts will have these blocked for security reasons unless they are already used for something else. You can't have 2 things listening on the same port number. If they haven't blocked these ports you could always try opening one. If you want to try it, use a port number over 1024.

On the flash side, you want to use the XMLSocket object to make your connection. Once you get a connection you send XML to the server through the socket and receive them in a similar manner to the standard XML object.

The thing that is often missed when sending messages from the server is that they must end with a zero byte. Until the flash app reads the zero byte it assumes the server is not done sending data and doesn't do anything with it.