×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    2

    Problem receiving >1024bytes

    While using Streamconnection my phone keeps crashing if i try to send more than 1024bytes of data.

    Is there a known issue as to why?

    I can provide more info if it is needed,

    thanks for your help

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    You didn't supply much information about how you implemented the data receiving, so I'm going to take a wild guess:

    Are you are reading the data using InputStream.read(byte[],int,int) or InputStream.read(byte[])?
    If you are then you have to make sure you are actually reading all the data. Even if the byte array you pass to these methods is big enough for all the data, the methods don't guarantee that all the data will be read in one go. They return the number of bytes read, so you have to check this number, compare it to the total amount of data you are expecting and keep on reading if necessary. Another option is to use DataInputStream.readFully(byte[]).

    shmoove

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×