-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClientDemo.java
33 lines (26 loc) · 1.07 KB
/
ClientDemo.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
import java.io.IOException;
import java.net.Socket;
import javax.swing.JOptionPane;
import client.Dashboard;
import client.LoginPage;
import client.RequestHandler;
import lib.SocketPacketHandler;
import server.Config;
public class ClientDemo {
public static void main(String[] args) {
Socket connection = null;
try {
connection = new Socket(Config.SERVER_IPV4.getStrVal(), Config.SERVER_PORT.getIntVal());
} catch (IOException e) {
JOptionPane.showMessageDialog(null, "Cant connect into Server!", "Error", JOptionPane.ERROR_MESSAGE);
}
SocketPacketHandler handler = new SocketPacketHandler(connection);
RequestHandler reqHandler = new RequestHandler(handler.handler);
if (new LoginPage(reqHandler).Auth() == false) {
JOptionPane.showMessageDialog(null, "login failed! Please login again or try later.", "ERROR",
JOptionPane.ERROR_MESSAGE);
};
Dashboard Panel = new Dashboard(reqHandler);
Panel.setVisible(true);
}
}