----- Original Message -----
From: "Jonathan Mangin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, June 19, 2004 11:16 AM
Subject: [OT] Multiple text lines over socket
Sorry about OT...
Can someone point me to a technique for reading multiple lines terminated
with newlines (paragraphs?) from a socket in a single read?
Thanks,
Jon
To answer my own question:
StringBuffer buffer = new StringBuffer();
while ((text = socketIn.readLine()) != null) {
if (!text.equals("bye")) {
buffer.append(text + "\n");
continue; // Doh!
}
System.out.println(buffer);
...
buffer = new StringBuffer();
...
}
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant archives, FAQs and Forums on JSPs can be found at:
http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com