Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to send a big list over TCP Sockets - Blackberry
    primarykey
    data
    text
    <p>I'm trying to send a list of 600 records over TCP/IP sockets using a java server and a Blackberry client. But every time it reaches the 63th record it stops, the odd thing about this is that if I only send 200 records they are sent ok.</p> <p>I haven't been able to understand why it happens, only that 63 records equals aprox to 4kB, basically it sends:</p> <ul> <li>an integer with the total number of records to be sent And for every record</li> <li>an integer with the length of the string</li> <li>the string </li> <li>a string terminator "$$$"</li> </ul> <p>Since i need to send the whole 600 i have tried to close the InputStreamReader and reopen it, also reset it but without any result.</p> <p>Does anybody else have experienced this behaviour? thanks in advanced.</p> <p>EDIT</p> <p>Here the code that receives:</p> <pre><code>private String readfromserver() throws IOException { int len=_in.read(); // receives the string length if (len==0) // if len=0 then the string was empty return ""; else { char[] input = new char[len+1]; for (int i = 0; i &lt; len; ++i) input[i] = (char)_in.read(); StringBuffer s = new StringBuffer(); s.append(input); return s.toString(); } } private void startRec(String data) throws IOException { boolean mustcontinue=true; int len=_in.read(); // read how many records is about to receive if (len==0) { scr.writelog("There is no data to receive"); } else { for(int i=0; i&lt;len; i++) if (mustcontinue) { mustcontinue=mustcontinue &amp;&amp; showdata(readfromserver()); } else { scr.writelog("Inconsistency error #19"); } } } </code></pre> <p>the function showdata only shows the received string in a LabelField.</p> <p>The code in the server:</p> <pre><code>try { _out.write(smultiple.size()); // send the number of records _out.flush(); for (int x=0; x&lt;smultiple.size(); x++) { int l=smultiple.elementAt(x).length(); _out.write(l); // send string length if (l&gt;0) _out.write(smultiple.elementAt(x)); // send string } _out.flush(); } catch (Exception e) { principal.dblog(e.toString()); } </code></pre> <p>smultiple is a vector containing the strings and everyone already have the terminator $$$.</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload