Package tk.doraneko.tcp.sendfile.simple
Class Server
- java.lang.Object
 - 
- tk.doraneko.tcp.sendfile.simple.Server
 
 
- 
- All Implemented Interfaces:
 Runnable
public class Server extends Object implements Runnable
Server cho phép client gửi nhiều file cùng một lúc, sử dụng thread. Ưu: dễ cấu hình. Nhược: ngốm bộ nhớ (heap) nếu dung lượng file lớn, lỗi khi dung lượng file lớn hơn dung lượng khả dụng của pc- Since:
 - 13/10/2019
 - Author:
 - tranphuquy19@gmail.com
 
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description private classServer.ServerThreadThread nhận các file theo từng client 
- 
Field Summary
Fields Modifier and Type Field Description private intportprivate ServerSocketserverSocketprivate Server.ServerThreadserverThreadprivate Threadthreadprivate StringworkingDir 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddThread(Socket socket)static voidmain(String[] args)private voidopen()voidrun()private voidstart() 
 - 
 
- 
- 
Field Detail
- 
serverSocket
private ServerSocket serverSocket
 
- 
thread
private Thread thread
 
- 
serverThread
private Server.ServerThread serverThread
 
- 
port
private int port
 
- 
workingDir
private String workingDir
 
 - 
 
- 
Constructor Detail
- 
Server
public Server(int port, String workingDir) throws IOException- Throws:
 IOException
 
 - 
 
- 
Method Detail
- 
open
private void open() throws IOException- Throws:
 IOException
 
- 
start
private void start()
 
- 
addThread
private void addThread(Socket socket) throws IOException
- Throws:
 IOException
 
- 
main
public static void main(String[] args) throws IOException
- Throws:
 IOException
 
 - 
 
 -