Re: Getting data from server

[email protected] Tue, 19 Aug 2008 14:17:04 PDT
Newsgroups gmane.comp.java.sun.kvm
Message-ID <10993014.41521219180655599.JavaMail.tomcat@sdcst12.sjc.collab.net>
Oh sure there is a way to keep constant connection between the device and the server.
Your question was why did the  while( (c = is.read()) != -1)... code never  get a -1 condition.

What you want to do is setup a protocol that you can monitor for a known end state.
So in a email client commands have a newline to determine the completion of a response.
When sending text from a message that might have embedded newlines I think there was a
period on a separate line.
Here is the link to the Email RFC: http://www.ietf.org/rfc/rfc1939.txt

So figure out a protocol, either binary, or textual (FYI.. Binary will be smaller) then in your while loop look for your end of state marker, change the state then start waiting for the start of the next state.  

-Shawn
[Message sent by forum member 'sfitzjava' (sfitzjava)]

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

===========================================================================
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".