Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions CSE-VI-B/Client.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import java.io.*;
import java.net.*;

public class Client{
public static void main(String[] args){
try{
Socket s = new Socket("localhost", 1234);
DataOutputStream dout = new DataOutputStream(s.getOutputStream());
DataInputStream din = new DataInputStream(s.getInputStream());
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

String str = "", str2 = "";
while(!str.equals("bye")){
str = br.readLine();
dout.writeUTF(str);
dout.flush();
str2 = din.readUTF();
System.out.println("Server: " + str2);
}
din.close();
s.close();
}
catch(Exception e){
System.out.println(e);
}
}
}
Binary file added CSE-VI-B/Q2clientOutput.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added CSE-VI-B/Q2serverOutput.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added CSE-VI-B/Q3output.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added CSE-VI-B/Q3output2.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions CSE-VI-B/Server.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//created by shilpisharma
import java.io.*;
import java.net.*;

public class Server{
public static void main(String[] args){
try{
ServerSocket ss = new ServerSocket(1234);
Socket s = ss.accept();
System.out.println("Online");
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("bye")){
str = din.readUTF();
System.out.println("Client: " + str);
str2 = br.readLine();
dout.writeUTF(str2);
dout.flush();
}
din.close();
ss.close();
s.close();
}
catch(Exception e){
System.out.println(e);
}
}
}