caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Joel Reymont <joelr1@gmail.com>
To: OCaml List <caml-list@inria.fr>
Subject: Mac OSX getsocketpair/getsockname and IPv6
Date: Sat, 5 May 2007 14:53:48 +0100	[thread overview]
Message-ID: <C40E6377-A236-4AAB-8B77-AD5A8CD93E27@gmail.com> (raw)
In-Reply-To: <75F71DDF-CACC-4AD9-A3DA-E0049FC9FB2F@gmail.com>

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/






  parent reply	other threads:[~2007-05-05 13:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-05 12:40 ocamlnet: EAFNOSUPPORT on Max OSX Joel Reymont
2007-05-05 12:50 ` Joel Reymont
2007-05-05 12:57   ` [Caml-list] " Richard Jones
2007-05-05 14:00     ` Joel Reymont
2007-05-05 13:53   ` Joel Reymont [this message]
2007-05-05 14:13     ` Serious bug in the OCaml FFI? Joel Reymont
2007-05-05 14:56       ` [Caml-list] " Olivier Andrieu
2007-05-05 15:24         ` Joel Reymont
2007-05-05 14:31     ` Mac OSX getsocketpair/getsockname and IPv6 Joel Reymont
2007-05-05 15:16       ` Solved! (was Re: Mac OSX getsocketpair/getsockname and IPv6) Joel Reymont
2007-05-06 10:05         ` [Caml-list] " Gerd Stolpmann
2007-05-28 17:08         ` Paul Snively
2007-05-05 14:46     ` Mac OSX getsocketpair/getsockname and IPv6 Joel Reymont

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C40E6377-A236-4AAB-8B77-AD5A8CD93E27@gmail.com \
    --to=joelr1@gmail.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).