├── README.md
├── out
└── production
│ └── First_Client_App
│ └── Main.class
├── .idea
├── vcs.xml
├── .gitignore
├── misc.xml
└── modules.xml
├── First_Client_App.iml
└── src
└── Main.java
/README.md:
--------------------------------------------------------------------------------
1 | # First-Client-App
2 |
--------------------------------------------------------------------------------
/out/production/First_Client_App/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Mindula-Dilthushan/First-Client-App/HEAD/out/production/First_Client_App/Main.class
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Datasource local storage ignored files
5 | /../../../../:\MyWorksSpace\First_Client_App\.idea/dataSources/
6 | /dataSources.local.xml
7 | # Editor-based HTTP Client requests
8 | /httpRequests/
9 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/First_Client_App.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/Main.java:
--------------------------------------------------------------------------------
1 | import java.io.*;
2 | import java.net.Socket;
3 |
4 | public class Main {
5 | public static void main(String[] args) {
6 | try {
7 |
8 | Socket socket = new Socket("localhost",5000);
9 |
10 | DataInputStream dataInputStream = new DataInputStream(socket.getInputStream());
11 | DataOutputStream dataOutputStream = new DataOutputStream(socket.getOutputStream());
12 |
13 | BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
14 |
15 | String message="" , reply="";
16 |
17 | while (!message.equals("end")){
18 | reply = bufferedReader.readLine();
19 | dataOutputStream.writeUTF(reply);
20 | message=dataInputStream.readUTF();
21 | System.out.println(message);
22 | }
23 |
24 | dataInputStream.close();
25 | dataOutputStream.close();
26 | bufferedReader.close();
27 |
28 | } catch (IOException e) {
29 | e.printStackTrace();
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------