08-19-2011 02:17 AM
I need to get more than 15000 bytes of data from inputstream at a time but, I can receive only 8192 bytes of data from inputstream. How can i increase inputstream size.
And, I am working in chat application using xmpp server. How can i get one by one response from xmpp. Now i am getting more than 3 response at a time,I used timer to get response.
Help me please,
Thank you in advance.
08-19-2011 04:16 AM
I am not aware of the xmpp protocol, however I can say I have not heard of any restriction in the BB that will restrict any inputstream to just 8K. So this issue is either in your code or in the protocol. My first reaction would be to check the code. You might find the IOUtilities methods useful for getting all the data from an inputstream, rather than coding your own, if you have done so.
08-19-2011 06:19 AM
Thanks for your reply peter_strange.
I used the following code.
System.out.println("Available Inputstream data : "+is.available());
String str =newString(data);
I can get available inputstream data is 8192. But the 2nd line is not executing i.e. I cannot get the bytes length and data. I am developing blackberry bold 9930.
08-19-2011 07:17 AM
available() is a guide, it is not definitive. So if it says 8192, then you have at least 8192. If it says 0, then may have nothing, but you might also get something if you do the read.
I don't understand this comment "the seond line is not executing". Either it will complete, or it will throw an exception. If you never see the output from the
then I suspect you are seeing an Exception. You will have caught this somewhere. What Exception do you see? What is the detail message?
08-19-2011 10:42 AM
Ah, OK. I thought you were reading an http connection. I have had a quick look at the xmpp protocol, and it would seem that you open a Stream connection. As such, the read will not complete on EOF, so IOUtilities is the wrong tool for you.
I have not managed to figure out how many bytes you are supposed to read. Until the end of the message seems the obvious answer which means you will have to parse the input, and keep asking for more until you get to the end.
My quick review suggests that the Blackberry is not a great platform for a client like this because it does not like to have sockets open all the time - these will be closed after 2 minutes of inactivity. So you might find that you can't actually code this on a BlackBerry.
I would do a search on this forum too. There seem to be a number of other people who have had problems coding xmpp processing on the BlackBerry.