Server Class: Name:Pandya Rohankumar Roll No:18mca020 Practical No:3
Server Class: Name:Pandya Rohankumar Roll No:18mca020 Practical No:3
Server Class: Name:Pandya Rohankumar Roll No:18mca020 Practical No:3
Roll no:18mca020
Practical no:3
Server Class
import java.io.DataInputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.io.*;
import java.net.*;
try{
System.out.println("Connection Established");
//DataInputStream dis=new DataInputStream(s.getInputStream());
//String str=(String)dis.readUTF();
pw.println(str);
//System.out.println("message: "+str);
ss.close();
}catch(Exception e){System.out.println(e);}
}
}
Client Class
import java.io.*;
import java.net.*;
try{
Socket ss=new Socket("localhost",6666);
System.out.println("Enter String");
String s,msg;
s = br.readLine();
pw.println(s);
msg = br1.readLine();
catch(IOException e)
System.out.println(e);
}
Output of Server Class