From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 4B701BC6B for ; Fri, 30 Mar 2007 13:28:13 +0200 (CEST) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.177]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l2UBSCtk008435 for ; Fri, 30 Mar 2007 13:28:13 +0200 Received: from [84.59.100.205] (helo=gate.lan.gerd-stolpmann.de) by mrelayeu.kundenserver.de (node=mrelayeu7) with ESMTP (Nemesis), id 0ML2xA-1HXFH90FmZ-0007V2; Fri, 30 Mar 2007 13:28:11 +0200 Received: from flakew.lan.gerd-stolpmann.de (fw.lan.gerd-stolpmann.de [192.168.1.1]) by gate.lan.gerd-stolpmann.de (Postfix) with ESMTP id A2630C094; Fri, 30 Mar 2007 13:28:10 +0200 (CEST) Subject: Re: [Caml-list] UDP client From: Gerd Stolpmann To: Alexsandro Soares Cc: caml-list@inria.fr In-Reply-To: <641576.48378.qm@web51609.mail.re2.yahoo.com> References: <641576.48378.qm@web51609.mail.re2.yahoo.com> Content-Type: text/plain; charset=ISO-8859-15 Date: Fri, 30 Mar 2007 13:28:09 +0200 Message-Id: <1175254090.1530.225.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V01U2FsdGVkX1+qynIQwlGjFPw82ZAQWMK+UQVCHWUwioZg2ad Q9g5VXNCNDQs+PXE3Cl/IELUD5yZxzbw+1ma/LLkREJa+alMD8 YyBDywmlwm/2mkNEK4sscFVd4lrGv9s X-Miltered: at discorde with ID 460CF44C.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; gerd:01 stolpmann:01 threads:01 gerd:01 donnerstag:01 ocaml:01 sig:01 fcntl:01 getpid:01 val:01 fcntl:01 val:01 nonblock:01 beginner's:01 ocaml:01 Well, there is no binding that would allow you to do that (emitting SIGIO when a datagram arrives). In my opinion it is better not to use SIGIO for new code, because signals are hard to manage. So my advice would be: Rewrite it. Use either select or threads or both for receiving datagrams in parallel with other activities.=20 Gerd Am Donnerstag, den 29.03.2007, 19:23 -0700 schrieb Alexsandro Soares: > Hi all, >=20 > I'm working in an UDP client, but I can't figure out how to get the s= ame behaviour, in OCaml, such as the C code below: >=20 > -----------------------------------------------------------------------= ------------------------ >=20 > sigset_t sigmask; >=20 > sigemptyset(&sigmask); > sigaddset(&sigmask, SIGIO); =20 > sigprocmask(SIG_BLOCK, &sigmask, NULL); > =20 > /* > * Open UDP socket. > */ > if( (sockfd =3D socket(AF_INET, SOCK_DGRAM, 0)) < 0){ > return sock ; /* Can't open socket. */ > } > =20 > if (fcntl(sockfd, F_SETOWN, getpid()) =3D=3D -1) return sock; >=20 > val =3D fcntl(sockfd, F_GETFL, 0) ; >=20 > val |=3D O_NONBLOCK ; > val |=3D FASYNC; > fcntl(sockfd, F_SETFL, val) ; >=20 > -----------------------------------------------------------------------= ------------- >=20 > Could anyone help me? >=20 > Thanks, >=20 > Alex >=20 >=20 >=20 >=20 > __________________________________________________ > Fale com seus amigos de gra=E7a com o novo Yahoo! Messenger=20 > http://br.messenger.yahoo.com/=20 >=20 > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >=20 --=20 ------------------------------------------------------------ Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany=20 gerd@gerd-stolpmann.de http://www.gerd-stolpmann.de Phone: +49-6151-153855 Fax: +49-6151-997714 ------------------------------------------------------------