rhxk has asked for the wisdom of the Perl Monks concerning the following question:
If no process is sending something to this listening process (above)use MY::Variables; use Socket; $addr = sockaddr_un($LogSocket); socket(SERVER, PF_UNIX, SOCK_DGRAM, 0) || die "Could not create socket +: $!"; unlink("$LogSocket"); bind(SERVER, $addr) || die "Could not bind: $!"; #select((select(SERVER), $| = 1)[0]); #enable command buffering while (1) { $x = recv(SERVER,$msg,1024,0); if (defined($x)) { my ($time,$level,$Program,$message,@sites) = split(chr(28),$ms +g); foreach my $site (sort @sites) { my $email = "$time [$Program] $message"; open(LOG, ">> $GnrtLog/$site.log") || die "cannot open $Lo +gSocket $!"; print LOG $email; close(LOG); } } else { print "hi"; $count++; }
use MY::Variables; use Socket; <some irrelevant stuff here> if (socket(SERVER, PF_UNIX, SOCK_DGRAM, 0)) { my $send = send(SERVER, $message, 0, sockaddr_un($LogSocke +t)); if (defined($send)) { print "sent $message"; } } else { print "I couldn't connect $!"; } close(SERVER);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: clashing sockets?
by ikegami (Patriarch) on Sep 07, 2004 at 22:42 UTC | |
by rhxk (Beadle) on Sep 07, 2004 at 22:48 UTC | |
by ikegami (Patriarch) on Sep 07, 2004 at 22:56 UTC | |
by rhxk (Beadle) on Sep 08, 2004 at 19:53 UTC |