-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServer.java
More file actions
32 lines (26 loc) · 824 Bytes
/
Server.java
File metadata and controls
32 lines (26 loc) · 824 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
30
31
32
//Atul_Lakhera_1018462
import java.net.*;
import java.io.*;
public class Server
{
public static void main(String args[])throws Exception
{
ServerSocket ss=new ServerSocket(8081);
Socket s=ss.accept();
System.out.println("Online");
DataInputStream dataRead=new DataInputStream(s.getInputStream());
DataOutputStream dataWrite=new DataOutputStream(s.getOutputStream());
BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
String str="",str2="";
while(!str.equals("bye")) //Atul_Lakhera1018462
{
str=dataRead.readUTF();
System.out.println("Client :"+str);
str2=br.readLine();
dataWrite.writeUTF(str2);
dataWrite.flush();
}
dataRead.close();
s.close();
}
}