-
Notifications
You must be signed in to change notification settings - Fork 0
/
ClientToServerThread.java
37 lines (35 loc) · 1009 Bytes
/
ClientToServerThread.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import java.io.OutputStream;
import java.util.ArrayList;
import java.io.DataOutputStream;
import java.io.PrintWriter;
import java.io.OutputStreamWriter;
class ClientToServerThread extends Thread
{
private OutputStream toHost;
private ArrayList pedido;
public ClientToServerThread(DataOutputStream toHost, ArrayList pedido) throws Exception
{
this.toHost = toHost;
this.pedido = pedido;
start();
}
/*
* Transmita os dados recebidos da class proxyclient thread para o host do qual queremos a paginas
* e outros dados.
*/
public void run()
{
try
{
PrintWriter out = new PrintWriter(new OutputStreamWriter(toHost));
for (int i = 0; i < pedido.size(); ++i) {
out.println(pedido.get(i));
}
out.println();
out.flush();
}
catch (Exception e) {
System.out.println("Erro ClientToServerThread : " + e);
}
}
}