Hi,
        i'm using mod_perl to run a Unix domain socket client to connect to
a server (wriiten in C). When i run the server and run the perl client as a
stand-alone perl program it connects to the socket just fine and exchanges
the relevant information. When i put the same lines into a mod_perl program,
I keep getting the following error in the error_log:

null:Can't connect to /home/tom/ipc/echo_socket: Connection refused at
/home/tom/ipc/mpipc.pl line21

Here are the lines i use (which work for a standalone perl program!) in the
script mpipc.pl

use Apache::Request ();
use Socket;
use strict;

my $r = shift;
my $apr = Apache::Request->new($r);
........
........
........ gather info from request obj here!
........

socket(CLIENT,PF_UNIX,SOCK_STREAM,0);
connect(CLIENT,sockaddr_un("/home/tom/ipc/echo_socket")) or die "Cant
connect to /home/tom/ipc/echo_socket: $!";

Above line is where the script fails as it can't connect! I set the
permissions on the socket file to rwx for everybody!
i.e. chmod 777 echo_socket
but i still am refused a connection to it!
(I also know IO::Socket may be an option but when i tried using it in a
standalone perl program it absolutely refuses
to connect to the C server)
My question is does anybody know why i can't connect to this socket from a
mod-perl script even though the above code connects fine from an ordinary
perl program?

Apache/1.3.12 (Red Hat linux)
mod_perl/1.21
Perl 5.00503

Any help would be greatlt appreciated!

Thomas.




Thomas Reilly
Software Consultant,

Distributed Software Consultancy Ltd.,
Ballybrit Business Park,Galway,Ireland.
Tel: +353 (91) 760541 Fax: +353 (91) 760542
e-mail: [EMAIL PROTECTED]
web: http://www.dscie.com


Reply via email to