Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I don't know how to solve this problem, even Perldoc provides no solution.
I want that the a server reads a file and sends each line to as many clients as connected, then reads the next line and so on.
Normally the server-program spawns a child as soon as a client knocks at the door. Then each kid is reading from the file and sends each $line to the client independedly.
But I want - let me say - synchronize the clients so that they receive the same line at (allmost) the same time.
The example of synchronized clients by sending the time (e.g. Perldoc, SavePipes..) doesn't work for me, because each spawned kid of the server graps with 'localtime' a common and therefore synchronized resource. But I have to create the common resource myself, s.th. like
open (READ, "< $file"); # common source (Server-Mom)
while (!condition) { sleep 1 }; # wait until all have connected (Server-Mom)
while (<READ>) { print; sleep 1;} # to each client so part of the Server-Kid
Can s.o. help me with the code before,in between and after my lines?
Thanks a lot in advanve,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Socket: Server shall send same $line to several clients
by castaway (Parson) on Feb 22, 2003 at 16:13 UTC | |
by Anonymous Monk on Feb 23, 2003 at 10:13 UTC | |
by Anonymous Monk on Feb 24, 2003 at 11:43 UTC |