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.7 required=5.0 tests=DATE_IN_PAST_06_12 autolearn=disabled version=3.1.3 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id E0D82BC0B for ; Sat, 6 Jan 2007 05:13:17 +0100 (CET) Received: from cgpmail.ua.pt (frontend-1.servers.ua.pt [193.136.173.2]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l064DHit008653 for ; Sat, 6 Jan 2007 05:13:17 +0100 Received: from [84.90.81.151] (account a25285@alunos.det.ua.pt HELO [192.168.0.3]) by frontend1.cgpmail.ua.pt (CommuniGate Pro SMTP 5.0.10) with ESMTPSA id 33307546 for caml-list@yquem.inria.fr; Sat, 06 Jan 2007 04:13:16 +0000 Message-ID: <459EA5A0.8060000@alunos.det.ua.pt> Date: Fri, 05 Jan 2007 19:23:12 +0000 From: Frederico Valente User-Agent: Thunderbird 1.5.0.9 (X11/20061219) MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Udp connection problem Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 459F21DD.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 3.2:98 unix:01 unix:01 compiling:02 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!