oK....I think I may have this figured out...i write the script first, it can be activated from the command line or from a browser. once the script is run, the SOCKET LISTENER is created which will listen for message (telnet or otherwise) on the prescribed PORT. the script may or may not continue to run depending on its structure.
now i have another point of confusion...
if I want my server to communicate with two different clients at once and pass information between them, how do I get the two different sessions to share data without writing a file? in other words, if i have a replica of the classic Atari tank combat game and there are two players...
Player 1 (where session_id = 'foo')
Player 2 (where session_id = 'bar')
and they both access the socket i've created on port 1234 with my file 'socket.php', how do I let Player 1 know that Player 2 is shooting at him?