#!/usr/bin/perl use strict; use IO::Socket; my $socketfile ="/var/run/ldapcached.sock"; ##my $socketfile ="/tmp/arun.sock"; if ( $ARGV[0] =~ m/-?client/ ) { ########### Client Code ########### #print "Client"; if ( -S $socketfile ) { my $client = IO::Socket::UNIX->new(Peer => $socketfile, Type => SOCK_STREAM ) or die $!; my $string = "$ARGV[1] =!= $ARGV[2]\n"; ## send data to unix socket print $client $string; $client->flush; chomp(my $line = <$client>); print $line."\n"; $client->close; exit 0; } else { print "\n Unix socket file '$socketfile' doesn't exist\n"; exit 1; } } else { print " * Usage: $0 < --client >";} #end print "\n";