Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 74027 invoked from network); 19 Feb 2007 14:08:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 19 Feb 2007 14:08:46 -0000 Received: (qmail 78789 invoked by uid 500); 19 Feb 2007 14:08:53 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 78220 invoked by uid 500); 19 Feb 2007 14:08:52 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 78211 invoked by uid 99); 19 Feb 2007 14:08:52 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Feb 2007 06:08:52 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of mikhail.a.markov@gmail.com designates 64.233.182.187 as permitted sender) Received: from [64.233.182.187] (HELO nf-out-0910.google.com) (64.233.182.187) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Feb 2007 06:08:41 -0800 Received: by nf-out-0910.google.com with SMTP id d4so2419807nfe for ; Mon, 19 Feb 2007 06:08:20 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=d2PEJHywAk7T/xHijfOSzW7KuKnGrYJSXqtufg54Dk8HsXY7GMUh7VUcPkhk0HUp4sPYtZSJNGPu1p6ZHkBFUHy2PspK36QCi/vMMfkgcTKgN+C4fAlJkpc+3vHlMd9outCmJ51zhfMBj/8RhLG45sLnkAjguhZ0y3eNuU4EINM= Received: by 10.82.154.2 with SMTP id b2mr10891284bue.1171894099696; Mon, 19 Feb 2007 06:08:19 -0800 (PST) Received: by 10.82.191.19 with HTTP; Mon, 19 Feb 2007 06:08:19 -0800 (PST) Message-ID: <51abf0750702190608o15cda171s2a8af7079834f0c@mail.gmail.com> Date: Mon, 19 Feb 2007 17:08:19 +0300 From: "Mikhail Markov" To: dev@harmony.apache.org Subject: Re: [classlib][luni] Sending datagrams with 0 length In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_48429_3501638.1171894099575" References: <51abf0750702190238r59080f3do2502448f098380bf@mail.gmail.com> <51abf0750702190316j3551744bod88fb8ab8d4c09d8@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_48429_3501638.1171894099575 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 1) Here is UDP rfc: http://www.ietf.org/rfc/rfc768.txt. It's clearly says that: "Length is the length in octets of this user datagram including this header and the data. (This means the minimum value of the length is eight.)", i.e. allows packets with empty data part. 2) JAVA API spec for UDP says nothing about empty data buffers, it only prohibits using null data buffers and negative or greater that the packet's data buffer lengths. 3) I found no info in Windows API forbidding sending UDP packets with zero data length. I'm wondering why these failures were not detected on Windows before... Perhaps i have a "special" version of WinXP :-) or it requires some additional configuring. Regards, Mikhail On 2/19/07, Alexey Petrenko wrote: > > > Yes. > OK. > Is it OK to send zero sized UDP packet according to UDP spec and Win32 > documentation? > > SY, Alexey > > > On 2/19/07, Alexey Petrenko wrote: > > > > > > I did not quite understand. > > > Does your test fail on RI on Win? > > > > > > SY, Alexey > > > > > > 2007/2/19, Mikhail Markov : > > > > Hi! > > > > > > > > I found a difference between sending datagram packets with zero > length > > > on > > > > Windows and Linux: > > > > The test below passes both on RI and Harmony on Linux, but fails on > my > > > > WinXP: > > > > RI: Exception in thread "main" java.net.SocketException: The message > is > > > > larger than the maximum supported by the underlying transport: > Datagram > > > send > > > > failed > > > > at java.net.PlainDatagramSocketImpl.send(Native Method) > > > > at java.net.DatagramSocket.send(DatagramSocket.java:612) > > > > at Test.main(Test.java:9) > > > > > > > > Harmony: Exception in thread "main" java.net.SocketException: > (10040) A > > > > message sent on a datagram socket was larger than the internal > message > > > > buffer or some other network limit, or the buffer used to receive a > > > datagram > > > > into was smaller than the datagram itself. > > > > at > > > org.apache.harmony.luni.platform.OSNetworkSystem.sendDatagramImpl > (Native > > > > Method) > > > > at > org.apache.harmony.luni.platform.OSNetworkSystem.sendDatagram( > > > > OSNetworkSystem.java:155) > > > > at org.apache.harmony.luni.net.PlainDatagramSocketImpl.send( > > > > PlainDatagramSocketImpl.java:275) > > > > at java.net.DatagramSocket.send(DatagramSocket.java:450) > > > > at Test.main(Test.java:9) > > > > > > > > Due to this I have 9 constantly failed testcases from > > > DatagramChannelTest > > > > (nio module): > > > > testSend_NoServerTwice(), > > > > testSend_NoServerNonBlockingTwice(), > > > > testReceiveSend_Block_Empty(), > > > > testReceiveSend_NonBlock_Empty(), > > > > testReceiveSend_Block_Empty_S2C(), > > > > testReceiveSend_NonBlock_Empty_S2C(), > > > > testReceiveSend_Block_Empty_C2S(), > > > > testReceiveSend_NonBlock_Empty_C2S(), > > > > testReceiveSend_Empty_S2S() > > > > trying to send empty datagrams. > > > > > > > > I've filed the appropriate JIRA > > > > https://issues.apache.org/jira/browse/HARMONY-3185, and even > provided > > > the > > > > patch (which seems not correct :-). > > > > > > > > What should we do with these tests? Perhaps it makes sense to rework > > > them to > > > > avoid sending empty datagrams? > > > > > > > > Regards, > > > > Mikhail > > > > > > > > Here is the test: > > > > import java.net.DatagramSocket; > > > > import java.net.DatagramPacket; > > > > import java.net.InetAddress; > > > > > > > > public class Test { > > > > public static void main(String[] args) throws Exception { > > > > DatagramSocket ds = new DatagramSocket(); > > > > DatagramPacket dp = new DatagramPacket(new byte[0], 0, > > > > InetAddress.getLocalHost(), 5555); > > > > ds.send(dp); > > > > } > > > > } > > > > > > > > > > ------=_Part_48429_3501638.1171894099575--