dstar has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to create a POE program that acts as a server for connections to unix domain sockets. However, as soon as I make this call:
$heap->{prompt_server} = POE::Wheel::SocketFactory->new ( SocketDomain => PF_UNIX, BindAddress => $heap->{session}->id."/prompt.socket", SuccessEvent => 'new_prompt_connection', FailureEvent => 'prompt_error', );
my script exits. I've got a debugging line above the call that confirms that $heap->{session}->id."/prompt.socket" expands to the right path, and I've got one immediately afterwards that's never reached. The subroutine for prompt_error never seems to be being called. Do I have something wrong in my call to SocketFactory? Shalon Wood

Replies are listed 'Best First'.
Re: POE::Wheel::SocketFactory problem
by JamesNC (Chaplain) on Nov 11, 2003 at 05:31 UTC
    What about specifying the port and protocol? From the docs example for a server
    $wheel = POE::Wheel::SocketFactory->new( BindAddress => $inet_address, # Sets the bind() address BindPort => $inet_port, # Sets the bind() port SuccessEvent => $success_event, # Event to emit upon accept() FailureEvent => $event_failure, # Event to emit upon error # Optional parameters (and default values): SocketDomain => AF_INET, # Sets the socket() domain SocketType => SOCK_STREAM, # Sets the socket() type SocketProtocol => 'tcp', # Sets the socket() protocol ListenQueue => SOMAXCONN, # The listen() queue length Reuse => 'no', # Lets the port be reused );
    Just a guess... JamesNC
Re: POE::Wheel::SocketFactory problem
by hangareighteen (Monk) on Nov 11, 2003 at 09:49 UTC
    Make sure you:
    use Socket;
    Within this program, and try changing tht PF_UNIX to an AF_UNIX.
      That wasn't the problem. Lack of including POE::Wheel::SocketFactory, however, could have greatly contributed to my problem. Time to add 'log errors to a file' functionality; the program uses Term::Visual, so when the program died STDERR never got a chance to be printed. Thanks!
Re: POE::Wheel::SocketFactory problem
by Anonymous Monk on Nov 11, 2003 at 19:07 UTC
    Also, don't forget, what 'prompt_error' and 'new_prompt_connection' here, is POE session states, not a package subroutines.