Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Setting unix socket options.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-01-13 (22:51)
From: tom hawkins <tomahawkins@y...>
Subject: [Caml-list] Setting unix socket options.
Hello all,

I just started playing with sockets through Ocaml, but I'm 
having difficultly setting options on a socket.
I can get the options just fine (getsockopt), but
when I try to set an option I get "permission denied".
Here's my test code:

open Unix;;

let s = socket PF_INET SOCK_STREAM 0;;

let f () =
  setsockopt s SO_DEBUG true;;

let main () =
  if not (getsockopt s SO_DEBUG) then begin print_string "DebugOff"; print_newline () end;
  handle_unix_error f ();;

main ();;

Compiles fine.  Running produces this:

./server: "setsockopt" failed: Permission denied

What am I doing wrong?


Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: