What are 'sockets' good for?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

What are 'sockets' good for?

Post by Gen-ik »

Sockets are one thing I haven't really learnt about but know from friends in the business that they are used a lot on 'virtual worlds' like Ibiza.com etc.

At the moment I am using Flash to call a PHP file every 10 seconds, and this PHP file sends the Flash movie all of the current variables (positions/actions/speach) etc of other people in the 'virtual world'.

But... will the use of Sockets make this any better or allow real-time updates?
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

Sorry.. I'm keeping this topic alive because I haven't had any replies yet.
hedge
Forum Contributor
Posts: 234
Joined: Fri Aug 30, 2002 10:19 am
Location: Calgary, AB, Canada

Post by hedge »

Sockets is a term thrown around that can refer to many things. To me it implies tcp/ip sockets which is just a pipe between processes.

I have attached a link to an example of some php code that uses a socket to connect to another website to pull some content.
viewtopic.php?t=7063

I am not an expert in this but I believe you would need to have a java applet embedded in your page that uses sockets to communicate to a servlet on the server in order to get real-time updates.
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

Ok thanks for that.

I think I will just stick with the way I'm doing things at the moment.. it's not real-time but there's only a few seconds lag between someone moving in the virtual-world and the movements being updated on everyone elses screen so it's almost-real-time.

I'll check out that link away :)
Post Reply