i need a brief code guide on sockets

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
The-Master
Forum Commoner
Posts: 45
Joined: Sun Aug 07, 2005 9:51 am
Location: Israel

i need a brief code guide on sockets

Post by The-Master »

hi, i have read some php sockets tutorials and i still need some help,
i made this code:

Code: Select all

<?php
$fp = fsockopen( "www.mysite.com", 80, $errno,
$errdesc);
// some code needed here <<<
fclose($fp);
?>
and i want to make that when a client connects to the server and another one does too they share the same vars.
in simple words if two users are connected, the value of the var "$nice_var" is the same for both users...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

If you don't have shared memory, there's no simple way to do it. You'll need an intermediary such as a file or database to hold the data. If you make any modifications of those variables you'll need synchronising code as well. Generally, I wouldn't recommend it.
Post Reply