- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClient.java
More file actions
Latest commit
29 lines (19 loc) · 643 Bytes
/
Copy pathClient.java
File metadata and controls
29 lines (19 loc) · 643 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
importjava.io.*;
importjava.net.*;
publicclassClient {
publicstaticvoidmain(String[] args) throwsException {
// TODO Auto-generated method stub
Clientc= newClient();
c.run();
}
publicvoidrun() throwsException{
//Create plain socket to accept from server socket
Socketsock=newSocket("localhost",4444);
PrintStreamPS = newPrintStream(sock.getOutputStream());
PS.println("Hello to server from the client");
InputStreamReaderIR= newInputStreamReader(sock.getInputStream());
BufferedReaderBR= newBufferedReader(IR);
Stringmessage=BR.readLine();
System.out.println(message);
}
}