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

Has anyone ever had success using IO::Socket::UNIX or Socket directly on Win32 to create AF_UNIX domain sockets? I see mixed info about supported/not-supported across 'Net.

I am currently using ActiveState Perl 5.8.

I would also be interested in comments regarding same on OpenVMS.

E.g.

Code 1:

...
use IO::Socket::UNIX; my ($parent_unix_socket,$child_unix_socket); #my $unix_socket_path = "/tmp/unix_socket"; my $unix_socket_path = "C:\\TMP\\unix_socket"; print $unix_socket_path . "\n"; $parent_unix_socket = IO::Socket::UNIX->new( Local => $unix_socket_pat +h, Listen => 1 ); unless ( $parent_unix_socket ) { unlink($unix_socket_path); Carp::croak("Failure To Create Listening Unix Socket: $!"); }
...

Result1:

C:\TMP\unix_socket

Failure To Create Listening Unix Socket: No such file or directory at dar.pl line 10

I've tried multiple incarnations of path -- no luck.

--adam

Replies are listed 'Best First'.
Re: AF_UNIX Domain Sockets on Windows using IO::Socket::UNIX
by pg (Canon) on Mar 09, 2003 at 02:30 UTC
    (I am using AS 5.8.0)

    AF_UNIX is not implemented for win32 (or let me be more careful, at least this win98 I am using).

    You cannot really see the fact clearly with IO::Socket::UNIX. If you open up the IO/Socket/UNIX.pm, you will see that, too many times, that module simply returns undef without any indication of the type of failure.

    But with this piece of code, you could get more specific indication:
    use Socket; socket(SOCKET, AF_UNIX, SOCK_STREAM, getprotobyname("tcp")); unlink("pool"); $pool = sockaddr_un("pool"); #fail, get error message "Socket::pack_so +ckaddr_un not implemented on this architecture", "un" stands for "uni +x", compare with sockaddr_in ("in" stands for "inet") connect(SOCKET, $pool);
      Thanks,

      Yup,

      perl -e "use IO::Socket::UNIX; print sockaddr_un('C:\TMP\unix_socket');" Socket::unpack_sockaddr_un not implemented on this architecture at C:/Perl/lib/Socket.pm line 380.

Re: AF_UNIX Domain Sockets on Windows using IO::Socket::UNIX
by Anonymous Monk on Aug 30, 2019 at 09:47 UTC

    I know it's an ancient thread, but it's very high in Google results for "af_unix perl" query, so I'm leaving an answer for people who might find it there.

    It is now possible to use AF_UNIX sockets with Perl under Windows. However, it requires a modern version of Windows, at least Windows 10 1803. Additionally, your Socket.pm version must be >= 2.029.