Hey, I want to make a messenger-style program that will transfer the message from a client to the other. I know that I should use sockets, but can you please give me an example how to transfer information between two clients?
Don't think of this as a cop-out, but try: http://www.hotscripts.com/PHP/Scripts_and_Programs/Chat_Scripts/index.html
What you're trying to do is not very easy to write yourself, and it is not the intention of PHP to do real-time client-server communication. PHP is a hypertext processor.
PHP chat scripts tend to look kind of crappy and put a lot of strain on the server's resources, too.
I have to agree with WeAnswer. You could look into the Jabber Protocol and use their base setup for transferring data. There's also some good Java clients that may offer some APIs to allow you to have a type of AJAX widget on your screen in PHP but the main meat of it is done in Java.
Tigase