Package tk.doraneko.tcp.chat.simple
Class Client
- java.lang.Object
-
- tk.doraneko.tcp.chat.simple.Client
-
public class Client extends Object
Client gửi nhận strings đến TCP Server- Since:
- 22/08/2019
- Author:
- tranphuquy19@gmail.com
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
Client.ClientListeningServer
-
Field Summary
Fields Modifier and Type Field Description private PrintWriter
printWriter
private Scanner
sc
private Socket
socket
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
listenServer()
static void
main(String[] args)
private void
start()
private void
stop()
-
-
-
Field Detail
-
socket
private Socket socket
-
sc
private Scanner sc
-
printWriter
private PrintWriter printWriter
-
-
Constructor Detail
-
Client
public Client(String serverIP, int serverPort) throws IOException
Thiết lập kết nối đến server theo IP và port của server- Parameters:
serverIP
- IP của ServerserverPort
- Port của Server- Throws:
IOException
-
-
Method Detail
-
start
private void start() throws IOException
- Throws:
IOException
-
stop
private void stop() throws IOException
- Throws:
IOException
-
listenServer
private void listenServer()
-
main
public static void main(String[] args) throws IOException
- Parameters:
args
- Start client with: args[] ={hostID, hostPort} or by default hostID="0.0.0.0" & hostPort=16057- Throws:
IOException
-
-