Discard

byte[] b = new byte[128];

try {
  Socket s = new Socket("metalab.unc.edu", 9);
  OutputStream theOutput = s.getOutputStream();
  while (true) {
    int n = theInput.available();
    if (n > b.length) n = b.length;
    int m = theInput.read(b, 0, n);
    if (m == -1) break;
    theOutput.write(b, 0, n);
 }
 s.close();
}
catch (IOException ex) {}

Previous | Next | Top | Cafe con Leche

Copyright 2003 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified July 14, 2000