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
29 changes: 29 additions & 0 deletions CSE-VI-A/Client.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//Atul_Lakhera1018462
import java.io.*;
import java.net.*;

public class Client
{
public static void main(String args[])throws Exception
{
Socket s=new Socket("localhost",8081);

DataInputStream dataRead=new DataInputStream(s.getInputStream());
DataOutputStream dataWrite=new DataOutputStream(s.getOutputStream());
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

String str="",str2=""; //Atul_Lakhera1018462

while(!str.equals("bye"))
{
str=br.readLine();
dataWrite.writeUTF(str);
dataWrite.flush();
str2=dataRead.readUTF();
System.out.println("server : "+str2);
}

dataRead.close();
s.close();
}
}
Binary file added CSE-VI-A/Q2 output.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions CSE-VI-A/SampleClassjdbc.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//atul_lakhera_1018462
package com.jdbc.project;
import java.sql.*;

public class SampleClassjdbc
{
public static void main(String args[]) throws SQLException
{
Connection myConn = null;
Statement myStmt = null;
ResultSet myRs = null;
try //atul_lakhera_1018462
{

myConn = DriverManager.getConnection("jdbc:mysql://localhost:3306/librarys", "root" , "");
myStmt = myConn.createStatement();
myRs = myStmt.executeQuery("select * from book");
while (myRs.next())
{
System.out.println(myRs.getString("Acc_no") + ", " + myRs.getString("Title") + ", " + myRs.getString("Author") + ", " + myRs.getString("Publisher")+ ", " +
myRs.getString("Edition"));

}
}
catch (Exception exc) //atul_lakhera_1018462
{
exc.printStackTrace();
}
finally
{
myRs.close();
myStmt.close();
myConn.close();
}
}
}
32 changes: 32 additions & 0 deletions CSE-VI-A/Server.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,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();
}
}
29 changes: 29 additions & 0 deletions Client.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//Atul_Lakhera1018462
import java.io.*;
import java.net.*;

public class Client
{
public static void main(String args[])throws Exception
{
Socket s=new Socket("localhost",8081);

DataInputStream dataRead=new DataInputStream(s.getInputStream());
DataOutputStream dataWrite=new DataOutputStream(s.getOutputStream());
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

String str="",str2=""; //Atul_Lakhera1018462

while(!str.equals("bye"))
{
str=br.readLine();
dataWrite.writeUTF(str);
dataWrite.flush();
str2=dataRead.readUTF();
System.out.println("server : "+str2);
}

dataRead.close();
s.close();
}
}
Binary file added Q2 output.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions Server.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,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();
}
}