-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServer.java
More file actions
23 lines (21 loc) · 736 Bytes
/
Server.java
File metadata and controls
23 lines (21 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import java.net.*;
import java.io.*;
class Server{
public static void main(String args[])throws Exception{
System.out.println("Waiting for connection");
ServerSocket ss=new ServerSocket(3334);
Socket s=ss.accept();
System.out.println("Connected");
DataInputStream din=new DataInputStream(s.getInputStream());
DataOutputStream dout=new DataOutputStream(s.getOutputStream());
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String str="",str2="";
while(!str.equals("stop")){
str=din.readUTF();
dout.writeUTF(str.toUpperCase());
dout.flush();
}
din.close();
s.close();
ss.close();
}}