Julio,
voce pode usar a classe TeeOutputStream, que eu fiz.
Ela duplica toda a saida de um stream para outros dois.
import java.io.*;
public class TeeOutputStream extends OutputStream {
private OutputStream out1, out2;
public TeeOutputStream(OutputStream out1, OutputStream out2) {
this.out1 = out1;
this.out2 = out2;
}
public void write(int b) throws IOException {
out1.write(b);
out2.write(b);
}
public void write(byte b[]) throws IOException {
out1.write(b);
out2.write(b);
}
public void write(byte b[], int off, int len) throws IOException {
out1.write(b, off, len);
out2.write(b, off, len);
}
public void flush() throws IOException {
out1.flush();
out2.flush();
}
public void close() throws IOException {
out1.close();
out2.close();
}
/* exemplo: */
public static void main(String args[]) {
try {
FileOutputStream f1 = new FileOutputStream("1.txt");
FileOutputStream f2 = new FileOutputStream("2.txt");
TeeOutputStream tee = new TeeOutputStream(f1, f2);
PrintWriter p = new PrintWriter(tee);
/* ou apenas:
PrintWriter p = new PrintWriter(new TeeOutputStream(f1,
f2));
*/
p.print("Alo Mundo!\n");
p.print(2.4);
p.print("\nFIM");
p.close();
}
catch (IOException e) {
System.err.println(e.toString());
}
}
}
julio wrote:
>
> Ol� Pessoal!
>
> Alguem tem um bom exemplo utilizando a classe Socket
> implementando servidor e cliente ?
>
> Minha duvida � como ecoar dados enviados do cliente para
> o servidor isto � n�o apenas no cliente.
>
> Grato
>
> Julio
>
> * Para nao receber mais e-mails da lista, acesse
><http://www.sun.com.br:8080/guest/RemoteAvailableLists>, coloque seu e-mail, escolha
>a lista <[EMAIL PROTECTED]> e de um <submit>.
--
Eduardo Issao Ito <[EMAIL PROTECTED]>
Eurosoft Consultoria <http://www.euroconsult.com.br>
Rua Marina Saddi Haidar, 176 - S�o Paulo - SP - Brasil
CEP 04650-050
TEL: +55 11 524-8022
FAX: +55 11 524-0408
* Para nao receber mais e-mails da lista, acesse
<http://www.sun.com.br:8080/guest/RemoteAvailableLists>, coloque seu e-mail, escolha a
lista <[EMAIL PROTECTED]> e de um <submit>.