-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathClient.java
More file actions
57 lines (38 loc) · 1.01 KB
/
Copy pathClient.java
File metadata and controls
57 lines (38 loc) · 1.01 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
50
51
52
53
54
55
56
57
import java.io.*;
import java.net.InetAddress;
import java.net.Socket;
/**
* Client class
* <p>
* Clients used for testing. It runs two threads.
*
* @author Zuhair Almansouri, lab sec L16
* @version December 11, 2021
*/
public class Client extends Thread {
/**
* Synchronize
*/
private static Object sync = new Object();
//Invoke the client method
public static void main(String[] args) throws IOException {
client();
}
//Run two client threads
public static void client() {
Client[] clients = new Client[]{new Client(), new Client()};
for (Client client : clients) {
client.start();
}
}
//Connect to the server
public void run() {
try {
Socket socket = new Socket("localhost", 1234);
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
}