
use IO::Socket;

use Fcntl ':flock';
 use Time::HiRes qw( usleep ualarm gettimeofday tv_interval nanosleep
		      clock_gettime clock_getres clock
                   );



my $file = "/tmp/flock";

my ($seconds, $microseconds) = gettimeofday;

$socket = IO::Socket::INET->new(PeerAddr => "81.169.141.129",
                                PeerPort => 3383,
                                Proto    => "tcp",
                                Type     => SOCK_STREAM,
                                Timeout  => 5)
	or die "Could not connect to $remote_host:$remote_port: $@\n";



open(WH,">$file");
	flock(WH,LOCK_EX);
	print $socket "find paris .jpg 300000 abc\r\n";
#	print WH "test";
flock(WH, LOCK_UN);
close WH;

my ($seconds1, $microseconds1) = gettimeofday;


print "Start: $microseconds\n";

print "End: $microseconds1\n";

my $diff =  $microseconds1 - $microseconds;
print "Diff: $diff microseconds \n" ;