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 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 6F798BC0B for ; Mon, 8 Jan 2007 15:26:20 +0100 (CET) Received: from mta5.srv.hcvlny.cv.net (mta5.srv.hcvlny.cv.net [167.206.4.200]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l08EQIWq012431 for ; Mon, 8 Jan 2007 15:26:20 +0100 Received: from [192.168.0.2] (ool-457da870.dyn.optonline.net [69.125.168.112]) by mta5.srv.hcvlny.cv.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTP id <0JBK00I4P03S8Q70@mta5.srv.hcvlny.cv.net> for caml-list@yquem.inria.fr; Mon, 08 Jan 2007 09:26:18 -0500 (EST) Date: Mon, 08 Jan 2007 09:27:43 -0500 From: Serge Aleynikov Subject: Re: [Caml-list] Udp connection problem In-reply-to: <459EA5A0.8060000@alunos.det.ua.pt> To: Frederico Valente Cc: caml-list@yquem.inria.fr Message-id: <45A254DF.4020909@hq.idt.net> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en References: <459EA5A0.8060000@alunos.det.ua.pt> User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Miltered: at discorde with ID 45A2548A.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; icmp:01 sockaddr:01 sockaddr:01 exn:01 exn:01 mainloop:01 printf:01 printf:01 mainloop:01 ocamlopt:01 gentoo:01 beginner's:01 ocaml:01 bug:01 3.2:98 Frederico, I believe the problem is that you are opening a server socket on a local address "127.0.0.1" rather than on a publicly-known address (stored in DNS) or any ("0.0.0.0"), and therefore only a client on the same host will be able to reach the server. Regards, Serge Frederico Valente wrote: > Hi! > > I am trying to communicate with an udp server currently in my computer. > The problem is that although I can send messages, and they are correctly > received, I dont get any message back (I should). Running a sniffer I > get an ICMP Unreacheable (Port Unreacheable) after the server response. > > Here is the code I'm using: > > let serverPort = 4001;; > let serverAddress = Unix.ADDR_INET(Unix.inet_addr_of_string "127.0.0.1", > serverPort);; > > let open_connection sockaddr = > let domain = Unix.domain_of_sockaddr sockaddr in > let sock = Unix.socket domain Unix.SOCK_DGRAM 0 in > try Unix.connect sock sockaddr ; > (Unix.in_channel_of_descr sock, Unix.out_channel_of_descr sock) > with exn -> Unix.close sock; raise exn > ;; > > > let mainLoop = > let inChannel,outChannel = open_connection serverAddress in > > while true do > output_string outChannel "(message)"; > flush outChannel; > let r=input_line inChannel in > Printf.printf "%s" r; > done > ;; > > mainLoop;; > > If there's anyone willing to see if the problem lies in this simple > code I would be extremely grateful. > I am compiling with ocamlopt in a 3.2Gh Pentium-d in 32 bits and > running gentoo linux. > > Thanks in advance! > > _______________________________________________ > 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 >