Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4424096

DatagramPacket spec needs clarification

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.4.0
    • core-libs
    • None
    • beta
    • generic
    • generic

      The current specification for DatagramPacket causes quite a lot of confusion among users.

      1. Some users are confused by the getData() methods to mean that what is returned is the actual data received or to be sent, while the matter of fact is the whole data buffer is returned and the actually data of interest should be obtained by combinations of the data buffer, the offset, and the length of the data. Something like, new String(dp.getData(), dp.getOffset(), dp.getLength()).

      2. Each time the user received some data in the data buffer, no long will the data length be set, but the length of the data buffer to use in future receive get set. This means that after each receive, the user has to call setLength() to reset the length of the buffer that will be used to receive the next data packet. This is very awkward and confusing.

            ywangsunw Yingxian Wang (Inactive)
            ywangsunw Yingxian Wang (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: