#!/usr/bin/perl -w # Author: Ferdi Franceschini # # dpid control program # Currently allows # register: Tells dpid to register all available dpis # stop: Stops dpid. use strict; use IO::Socket::INET; # Get socket directory name #open(DSD, "<$ENV{HOME}/.dillo/dpi_socket_dir"); #my $dir = ; #close(DSD); # Get dpid's listening port from saved file open(DSD, "<$ENV{HOME}/.dillo/dpid_comm_keys"); my $port = ; close(DSD); print "Got: localhost:$port\n"; my $socket = IO::Socket::INET->new(Peer => "localhost:$port", Type => SOCK_STREAM, Timeout => 1000 ) or die "new: $@"; $socket->autoflush(1); my %dpi_command = ( "register" => "", "stop" => "", ); if ( $#ARGV == 0 && exists($dpi_command{$ARGV[0]}) ) { print $socket $dpi_command{$ARGV[0]}; } else { close($socket); print "Usage: dpidc register|stop\n"; }