From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA22070; Thu, 23 Aug 2001 09:03:13 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id JAA22041 for ; Thu, 23 Aug 2001 09:03:12 +0200 (MET DST) Received: from d12lmsgate.de.ibm.com (d12lmsgate.de.ibm.com [195.212.91.199]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f7N73BH14507 for ; Thu, 23 Aug 2001 09:03:11 +0200 (MET DST) Received: from d12relay02.de.ibm.com (d12relay02.de.ibm.com [9.165.215.23]) by d12lmsgate.de.ibm.com (1.0.0) with ESMTP id JAA43806; Thu, 23 Aug 2001 09:03:10 +0200 Received: from d10hubm1.telaviv.ibm.com (d10ml001.telaviv.ibm.com [9.148.216.55]) by d12relay02.de.ibm.com (8.11.1m3/NCO v4.97) with ESMTP id f7N72rh29906; Thu, 23 Aug 2001 09:02:59 +0200 Importance: Normal Subject: Re: [Caml-list] Unix.socket_option in ocaml-3.0.2 To: jhw@wetware.com Cc: caml-list@inria.fr X-Mailer: Lotus Notes Release 5.0.7 March 21, 2001 Message-ID: From: "Ohad Rodeh" Date: Thu, 23 Aug 2001 10:02:49 +0300 X-MIMETrack: Serialize by Router on D10ML001/10/M/IBM(Release 5.0.6 |December 14, 2000) at 23/08/2001 10:03:08 MIME-Version: 1.0 Content-type: text/plain; charset=us-ascii Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk A few comments about the new socket interface: 1. It is an improvement over what we had previously. 2. There is bug in the socket options interface for WIN32 platforms (already fixed in the CVS). 3. I've asked for multicast additions a while ago, they exist in Ensemble for ages. 4. Why not use a simple sum type for socket options. Here's what we do in Ensemble: (* Options passed to setsockopt. *) type socket_option = | Nonblock of bool | Reuse | Join of inet | Leave of inet | Ttl of int | Loopback of bool | Sendbuf of int | Recvbuf of int | Bsdcompat of bool (* Set one of the above options on a socket. *) val setsockopt : socket -> socket_option -> unit Anyway, have fun with caml. Ohad. j h woodyatt @pauillac.inria.fr on 23/08/2001 01:45:10 Please respond to jhw@wetware.com Sent by: owner-caml-list@pauillac.inria.fr To: caml-list@inria.fr cc: Subject: [Caml-list] Unix.socket_option in ocaml-3.0.2 everyone-- I noticed that the Unix library module in 3.0.2 has an improved interface for socket options. I am grateful for the ability to set options that are not boolean values, but there are other options that are still out of reach for me. Specifically, the IP_MULTICAST_XXXX options, which want IP address values. I know you could just add more setsockopt_foo and getsockopt_foo functions, but I want to propose an alternative interface. Please consider something like the following as a possible addition to unix.mli (and the appropriate implementation in unix.ml): ---- BEGIN EXCERPT type socket_option_level and socket_option_name module type SocketOption_sig = sig type t val level: socket_option_level val name: socket_option_name end module type SocketOption_t = sig type t val set: fd:file_descr -> t -> unit val get: file_descr -> t end module SocketOption(S: SocketOption_sig) : SocketOption_t with type t = S.t module SO_DEBUG: SocketOption_t with type t = bool module SO_BROADCAST: SocketOption_t with type t = bool module SO_REUSEADDR: SocketOption_t with type t = bool module SO_KEEPALIVE: SocketOption_t with type t = bool module SO_DONTROUTE: SocketOption_t with type t = bool module SO_OOBINLINE: SocketOption_t with type t = bool module SO_ACCEPTCONN: SocketOption_t with type t = bool module SO_SNDBUF: SocketOption_t with type t = int module SO_RCVBUF: SocketOption_t with type t = int module SO_ERROR: SocketOption_t with type t = int module SO_TYPE: SocketOption_t with type t = int module SO_RCVLOWAT: SocketOption_t with type t = int module SO_SNDLOWAT: SocketOption_t with type t = int module SO_LINGER: SocketOption_t with type t = int option module SO_RCVTIMEO: SocketOption_t with type t = float module SO_SNDTIMEO: SocketOption_t with type t = float type ip_mreq = inet_addr * inet_addr module IP_ADD_MEMBERSHIP: SocketOption_t with type t = ip_mreq module IP_DROP_MEMBERSHIP: SocketOption_t with type t = ip_mreq module IP_MULTICAST_IF: SocketOption_t with type t = inet_addr module IP_MULTICAST_TTL: SocketOption_t with type t = int module IP_MULTICAST_LOOP: SocketOption_t with type t = bool module TCP_NODELAY: SocketOption_t with type t = bool ----- END EXCERPT Comments? (I know. Some of these options are more commonly available than others. I'm specifically interested in calling attention to the functorial interface I'm proposing.) I'm curious to know what are the tradeoffs associated with doing it this way. I can see how the nested modules are fairly easily done, but the functorial might be harder, but still possible (maybe with more members in the input signature, I don't know yet). Any ideas on how space and time performance would be affected? -- j h woodyatt "You're standing on sacred ground. Many strange and wonderful things have transpired right where you're standing." --unattributable ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr