Version française
Home     About     Download     Resources     Contact us    
Browse thread
ocamlnet: EAFNOSUPPORT on Max OSX
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] Re: ocamlnet: EAFNOSUPPORT on Max OSX
On Sat, May 05, 2007 at 01:50:09PM +0100, Joel Reymont wrote:
> # #use "topfind";;
> - : unit = ()
> 
> # #require "unix";;
> /usr/local/lib/ocaml/unix.cma: loaded
> 
> # let x, y = Unix.socketpair Unix.PF_UNIX Unix.SOCK_STREAM 0;;
> val x : Unix.file_descr = <abstr>
> val y : Unix.file_descr = <abstr>
> 
> # Unix.getsockname x;;
> Exception: Unix.Unix_error (Unix.EAFNOSUPPORT, "", "").
> 
> # Unix.getpeername x;;
> Exception: Unix.Unix_error (Unix.EAFNOSUPPORT, "", "").

You might want to run this under ktrace, but the error seems clear
enough from the getsockname man page on Mac OS X:

  BUGS
     Names bound to sockets in the UNIX domain are inaccessible; getsockname
     returns a zero length name.

(That differs from the observed behaviour, but returning an error
seems more probably than returning a zero length name).

In general, I wouldn't expect anonymous Unix domain sockets created by
socketpair to have a sockname (they're anonymous!), but I might expect
them to have some sort of peername - obviously they don't have that
either.

Rich.

-- 
Richard Jones
Red Hat