// A Java program for a Client
import [Link].*;
import [Link].*;
import [Link].*;
public class Client2 {
private Socket s = null;
public Client2(String address, int port)
{
try {
// In this Code Input Getting from a user
Scanner sc = new Scanner([Link]);
s = new Socket(address, port);
[Link]("Connected");
// Create two objects first is dis and dos for
// input and output
DataInputStream dis
= new DataInputStream([Link]());
DataOutputStream dos
= new DataOutputStream([Link]());
// Making a Loop
while (true) {
[Link](
"Name : Abhinandan Gaikwad Roll No : TA42");
[Link](
"Enter the operation in the form operand operator
operand");
[Link]("Example 3 + 5 ");
String inp = [Link]();
// Check the user input if user enter over
// then
// connect is stopped by server and user
if ([Link]("Over"))
break;
[Link](inp);
String ans = [Link]();
[Link]("Answer = " + ans);
}
}
catch (Exception e) {
[Link]("Error in Connection");
}
}
public static void main(String args[])
{
// Connection With Server port 5000
Client2 client = new Client2("[Link]", 5000);
}
}