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: Joel Reymont <joelr1@g...>
Subject: Mac OSX getsocketpair/getsockname and IPv6
The test C program [1] runs fine. I also tried extracting the  
relevant C bits from otherlibs/unix/{socket.c, socketaddr.h, etc.}  
and putting them together. Again, everything is fine but the  
following OCaml code still bombs out.

         Objective Caml version 3.10+dev26 (2007-04-25)

# #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, "", "").

I'm baffled but it definitely has something to do with IPv6 code in  
OCaml.

I'll try to recompile 3.10 without IPv6 support to see if it works  
and then will try to insert printouts into the C wrappers for  
socketpair and getsockname to see what OCaml is giving C with IPv6  
enabled.

	Thanks, Joel

[1] Sample C program:

#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>

int main (int argc, char** argv)
{
   int err, sv[2];
   struct sockaddr addr;
   socklen_t addr_len;

   err = socketpair(PF_UNIX, SOCK_STREAM, 0, sv);

   printf("socketpair: %d\n", err);

   addr_len = sizeof(addr);
   err = getsockname(sv[0], &addr, &addr_len);

   printf("getsockname: %d\n", err);

}


--
http://wagerlabs.com/