<[EMAIL PROTECTED]> writes:
> Any help on this question would be appreciated. I am a newbie to
> this site, so I have not figured my way around yet. Forgive me if
> this question is answered somewhere else.
>
> My application runs on RH Linux. I have set of perl processes that
> are communicating through a UNIX socket.
> my $s = IO::Socket::UNIX->new(
> Type => SOCK_STREAM,
> Local => $sockname,
> Listen => 10,
> ReuseAddr => 1,
> );
> One of these processes goes away for an extended period of time
> and comes back eventually. During the time that it is gone it is
> not able to read from it's pipe. This is causing the other process
> that is writing to the pipe to wait for an extended period of
> time. When this happens, bad things occur in my application.
>
> One idea I would like to try is to set the socket's underlying
> recieve buffer to as large as possible.
It's actually the send buffer you need to set for Unix domain sockets.
'man unix' on my Linux box tells me:
| (UN)SUPPORTED FEATURES
|
| The SO_SNDBUF socket does have an effect for Unix domain
| sockets, but the SO_RCVBUF option does not.
and 'man 7 socket' tells me:
| SO_SNDBUF
| Sets or gets the maximum socket send buffer in bytes.
| The kernel doubles this value (to allow space for
| bookkeeping overhead) when it is set using
| setsockopt(), and this doubled value is returned by
| getsockopt(). The default value is set by the
| wmem_default sysctl and the maximum allowed value is
| set by the wmem_max sysctl. The minimum (doubled)
| value for this option is 2048.
> Questions:
>
> Can anyone tell me how to set the socket's underlying receive
> buffer size?
I think others have already answered that, but try to adjust the
SO_SNDBUF instead of SO_RCVBUF.
> What is the maximum size that the buffer can be?
It's a kernel parameter controlled by the wmem_max sysctl. See quote
above.
> It seems that the writing process gets stuck trying to write to
> this processes socket. How do I make the writer return immediately
> even if it cannot write all of the data?
Try to set disable the blocking attribute of your socket handle:
$sock->blocking(0);
documented in 'IO::Handle'.
--Gisle
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs