Package tk.doraneko.tcp.sendfile.simple
Class Client
- java.lang.Object
-
- tk.doraneko.tcp.sendfile.simple.Client
-
public class Client extends Object
- Since:
- 14/10/2019
- Author:
- tranphuquy19@gmail.com
-
-
Field Summary
Fields Modifier and Type Field Description private DataOutputStream
dataOutputStream
private String
host
private ObjectInputStream
objectInputStream
private ObjectOutputStream
objectOutputStream
private int
port
private Socket
socket
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private FileInfo
getFileInfo(String filePath)
static void
main(String[] args)
void
sendFile(String filePath)
Gửi một file qua Serverprivate void
start()
-
-
-
Field Detail
-
socket
private Socket socket
-
dataOutputStream
private DataOutputStream dataOutputStream
-
objectOutputStream
private ObjectOutputStream objectOutputStream
-
objectInputStream
private ObjectInputStream objectInputStream
-
host
private String host
-
port
private int port
-
-
Constructor Detail
-
Client
public Client(String host, int port) throws IOException
- Throws:
IOException
-
-
Method Detail
-
start
private void start() throws IOException
- Throws:
IOException
-
getFileInfo
private FileInfo getFileInfo(String filePath) throws IOException, FileNotFoundException
- Throws:
IOException
FileNotFoundException
-
sendFile
public void sendFile(String filePath) throws IOException, ClassNotFoundException, FileNotFoundException
Gửi một file qua Server- Parameters:
filePath
- đường dẫn của file trên hệ thống- Throws:
IOException
ClassNotFoundException
FileNotFoundException
-
main
public static void main(String[] args) throws IOException, ClassNotFoundException
- Parameters:
args
- : args[] ={hostID, hostPort, filePath} or {filePath}- Throws:
IOException
ClassNotFoundException
-
-