#!/usr/bin/perl -w
#test_server run under administrator use strict; use IPC::Shareable; my $glue = 'test.key'; my %options = ( create => 1, exclusive => 0, mode => 0644, destroy => 1, ); my @arr; tie @arr, 'IPC::Shareable', $glue, { %options } or die "server: tie failed/n"; @arr = (); while (1) { print "Input:"; my $input=<STDIN>; chomp $input; if (defined $input) { push(@arr,$input); } print "/@arr:@arr/n"; } exit;
|
#!/usr/bin/perl -w
#test_client run under administrator
use strict; use IPC::Shareable; my $glue = 'test.key'; my %options = ( create => 0, exclusive => 0, mode => '0644', destroy => 0, size=>65536 #size must less then 65536 ); my @arr; my $ipch=tie @arr, 'IPC::Shareable', $glue, { %options } or die "client: tie failed/n"; while(1) { if (scalar @arr > 0) { $ipch->shlock; my $str=shift @arr; $ipch->shunlock; print "output:$str/n"; } else { sleep 3; } } exit;
|
<script type="text/javascript">
</script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>