-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathInfo.java
More file actions
46 lines (41 loc) · 1.27 KB
/
Info.java
File metadata and controls
46 lines (41 loc) · 1.27 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
package Data;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;
public class Info {
public Socket Socket = null;
public Socket ChatSoc = null;
public PrintWriter out = null;
public BufferedReader in = null;
public ObjectInputStream datain = null;
public ObjectOutputStream dataout = null;
public DTO dto = new DTO();
public Info() {
try {
String serverAddress = java.net.InetAddress.getLocalHost().getHostAddress();
Socket = new Socket(serverAddress, 9001);
ChatSoc = new Socket(serverAddress, 9002);
// Socket = new Socket("192.168.43.100", 9001);
// ChatSoc = new Socket("192.168.43.100", 9002);
out = new PrintWriter(ChatSoc.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(ChatSoc.getInputStream()));
dataout = new ObjectOutputStream(Socket.getOutputStream());
datain = new ObjectInputStream(Socket.getInputStream());
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public void setDTO(DTO dto) {
this.dto = dto;
}
public DTO getDTO() {
return dto;
}
}