-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClientSender.java
More file actions
49 lines (41 loc) · 1.03 KB
/
Copy pathClientSender.java
File metadata and controls
49 lines (41 loc) · 1.03 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
/**
*
*/
package node.server.main;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.net.Socket;
import java.net.UnknownHostException;
/**
* @author dell
*
*/
public class ClientSender extends Thread {
private String paramsIn = null;
private Socket destination = null;
private int paramsport = 4001;
private OutputStreamWriter outStreamWrite = null;
private Client cl;
public ClientSender(String params){
paramsIn = params;
cl = new Client();
}
public void run(){
sendParamsToCoordinator();
}
private void sendParamsToCoordinator(){
try {
destination = new Socket(cl.getCoordinator(), paramsport);
outStreamWrite = new OutputStreamWriter(destination.getOutputStream(), "UTF-8");
outStreamWrite.write(paramsIn,0, paramsIn.length());
outStreamWrite.close();
destination.close();
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}