Package tk.doraneko.tcp.chat.simple
Class ServerMultiClient
- java.lang.Object
-
- tk.doraneko.tcp.chat.simple.ServerMultiClient
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
ServerMultiClient.ServerThread
Class sinh các threads phục vụ từng client
-
Field Summary
Fields Modifier and Type Field Description private int
port
private ServerSocket
serverSocket
private ServerMultiClient.ServerThread
serverThread
private Thread
thread
-
Constructor Summary
Constructors Constructor Description ServerMultiClient(int port)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addThread(Socket socket)
static void
main(String[] args)
Main funcprivate void
open()
void
run()
private void
start()
private void
stop()
-
-
-
Field Detail
-
serverSocket
private ServerSocket serverSocket
-
thread
private Thread thread
-
serverThread
private ServerMultiClient.ServerThread serverThread
-
port
private int port
-
-
Constructor Detail
-
ServerMultiClient
public ServerMultiClient(int port) throws IOException
- Throws:
IOException
-
-
Method Detail
-
open
private void open() throws IOException
- Throws:
IOException
-
start
private void start()
-
stop
private void stop()
-
addThread
private void addThread(Socket socket) throws IOException
- Throws:
IOException
-
main
public static void main(String[] args) throws IOException
Main func- Parameters:
args
- Start Server with serverPort = args[0] or by default serverPort = 16057- Throws:
IOException
-
-