Getting data from server

[email protected] Mon, 18 Aug 2008 10:15:56 PDT
Newsgroups gmane.comp.java.sun.kvm
Message-ID <14942776.150041219079786560.JavaMail.tomcat@sdcst12.sjc.collab.net>
I'm implementing program as shown in article
[b]http://developers.sun.com/mobility/midp/articles/midp2network/[/b].

Part of the code that is bothering me is in section [b]Code Sample 4: EmailClient.java [/b]

is = sc.openInputStream();
int c = 0;
while (((c = is.read()) != -1) ) {
 sb.append((char) c);
}

To clear that out, I read that code like this: read for any byte on input stream until there is nothing more to read.

On the server side (server is not on a mobile device, but on PC) I just put dot (.) on the text sent by MIDlet and sending it back, as show here:

outputLine = inputLine + "!" + null;
out.println(outputLine);

To thing I cannot figure out is that code on mobile device loop throug stream sent by server and when it read the last sign it stops on [b]while (((c = is.read()) != -1) ) {[/b] and waits for another sign. Why?
[Message sent by forum member 'quo' (quo)]

http://forums.java.net/jive/thread.jspa?messageID=293980

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff KVM-INTEREST".  For general help, send email to
[email protected] and include in the body of the message "help".