my $s = IO::Socket::UNIX->new(
Type => SOCK_STREAM,
Local => $sockname,
Listen => 10,
ReuseAddr => 1,
);
if ( not $s ) {
logerr("Can't create socket $sockname : $!");
exit $PACE::Constants::DAEMON_EXIT;
}
# Vantive ? : Set the Socket to non-blocking.
$s->blocking(0);
my $tmp_val = $s->blocking();
logdbg( 15, "Blocking flag = $tmp_val\n");
...
logdbg(14, "writeSocket : File # $fn has $size bytes to send.\n");
# if no data to write just return
return if ($size == 0);
$sent = syswrite $wh, $buf, $size;
logdbg(14, "writeSocket : $size bytes attempted, $sent bytes written.\n");
...
06/01/31 15:49:56 Agent: writeSocket : File # 35 has 100098 bytes to send.
06/01/31 15:50:26 Agent: writeSocket : 100098 bytes attempted, 100098 bytes written.
Out of curiosity, what happens if you address blocking like this?
$s->blocking(0) or die $!;
I suppose it's possible that setting blocking off is failing, and this will let you know. It might not solve the issue, but at least you may discover where to dig.
Dave
Are you sure? You may be right, but that's not what the documents say. The blocking() method is inherited from IO::Handle, from what I can tell, and the documentation for IO::Handle says the following:
$io->blocking ( [ BOOL ] )
If called with an argument blocking will turn on non-blocking IO if BOOL is false, and turn it off if BOOL is true.blocking will return the value of the previous setting, or the current setting if BOOL is not given.
If an error occurs blocking will return undef and $! will be set.
...which should make it a good candidate for "or die $!;" syntax.
Dave
That's really confused. How do you determine the difference between success and failure with
$rv = $io->block(); ## Find out the current setting
if( !$rv ) {
## Is non-blocking enabled or did the call fail?
}
$rv = $io->blocking( 1 ); ## Turn on blocking (turn off non-blocking)
if( !$rv ) {
## Was non-blocking previously enabled or did the call fail?
}
$rv = $io->blocking( 0 ); ## Turn off blocking
if( !$rv ) {
## Did we succeed or did the call fail?
}
What would or die $! be telling you?
A candidate for "Bad Interface Award of 1995, 1996, 1997, ... " :)
perlmonks.org content © perlmonks.org and BrowserUk, davido, kwopublic
prlmnks.org © 2006 edmund von der burg (eccles & toad)
v 0.03