Uploaded image for project: 'JGroups'
  1. JGroups
  2. JGRP-1736

UDP: Android does not reset buffer length

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Minor
    • 3.4.1, 3.5
    • None
    • None

    Description

      Discussion at http://jgroups.1086181.n5.nabble.com/jgroups-users-PLEASE-HELP-ME-OUT-FOR-quot-JGroup-with-Android-quot-problem-td9537i20.html:
      Hi, Belaban..I think I have found the problem...after discovering this issue occurs only on all ICS devices I have and after reading through the "Android issue #24748 DatagramPacket truncated UDP" at http://code.google.com/p/android/issues/detail?id=24748, I have introduced the following modification at org.jgroups.protocols.UDP.java:

      public void run() {
      final byte receive_buf[]=new byte[66000]; // to be on the safe side (IPv6 == 65575 bytes, IPv4 = 65535)
      final DatagramPacket packet=new DatagramPacket(receive_buf, receive_buf.length);

      while(thread != null && Thread.currentThread().equals(thread)) {
      try

      { //Solved Android ISSUE #24748 - DatagramPacket truncated UDP in ICS if (Util.checkForAndroid()) packet.setLength(receive_buf.length); receiver_socket.receive(packet); int len=packet.getLength(); ... }

      catch(SocketException sock_ex)

      { ... }
      catch(Throwable ex) { ... }

      }

      ...
      }

      It seems to solve the EOFException but I am not sure the real impact on Jgroups library as a whole.

      Attachments

        Activity

          People

            rhn-engineering-bban Bela Ban
            rhn-engineering-bban Bela Ban
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: