FileDocCategorySizeDatePackage
AsyncReadSocket.javaAPI DocExample1305Tue Jan 28 17:12:52 GMT 1997None

AsyncReadSocket

public class AsyncReadSocket extends Thread

Fields Summary
private Socket
s
private StringBuffer
result
Constructors Summary
public AsyncReadSocket(Socket s)

          this.s = s;
          result = new StringBuffer();
     
Methods Summary
public synchronized voidappendResult(char c)

          result.append(c)
     
public synchronized java.lang.StringgetResult()

          String retval = result.toString();
          result = new StringBuffer();
          return retval;
     
public voidrun()

          DataInputStream is = null;
          try {
               is = new DataInputStream(s.getInputStream());
          } catch (Exception e) {}
          while (true) {
               try {
                    char c = is.readChar();
                    appendResult(c);
               } catch (Exception e) {}
          }