I did not quite understand.
Does your test fail on RI on Win?

SY, Alexey

2007/2/19, Mikhail Markov <[EMAIL PROTECTED]>:
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);
   }
}

Reply via email to