-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClient.java
More file actions
29 lines (25 loc) · 766 Bytes
/
Client.java
File metadata and controls
29 lines (25 loc) · 766 Bytes
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
package Chat;
import java.io.IOException;
import java.net.Socket;
/**
*The client Chat side
* @author joar
*/
public class Client extends Connection{
/**
*
* @param ip String of the ip to the server
* @param port the port to connect to
* @throws IOException if unable to connect
*/
public Client(String ip, int port) throws IOException {
Socket socket = new Socket(ip, port);
sockets.add(socket);
ChatWindow chatWindow = new ChatWindow(this, false);
chatWindow.setTitle("Client");
Thread messageParser = new Thread(new MessageParser(socket,
chatWindow.getConversation(),
chatWindow.getController(), this, true));
messageParser.start();
}
}