17EPCS005
PROGRAM:
CLIENT:
import [Link].*;
import [Link].*;
public class dateclient
{
public static void main(String args[])
{
try
{
InetAddress ia=[Link]();
[Link]("InetAddress of this Client is:"+ia);
Socket s=new Socket(ia,65534);
BufferedReader dis=new BufferedReader(new
InputStreamReader([Link]()));
String sdate=[Link]();
[Link]("Date from Server:"+sdate);
PrintWriter pw=new PrintWriter([Link](),true);
[Link](ia);
}
catch(IOException e)
{
[Link]("Exception caught:"+e);
}
}
}
SERVER:
import [Link].*;
import [Link].*;
import [Link].*;
public class dateserver
{
public static void main(String args[])
{
try
{
ServerSocket ss=new ServerSocket(65534);
Socket s=null;
[Link]("Press ctrl+c to quit !!!");
while(true)
{
s=[Link]();
PrintWriter pw=new PrintWriter([Link](),true);
Date d=new Date();
String dd=[Link]();
[Link]("Date in Server:"+dd);
[Link](dd);
BufferedReader dis=new BufferedReader(new
InputStreamReader([Link]()));
17EPCS005
String add=[Link]();
[Link]("InetAddress of Client:"+add);
}
}
catch(IOException e)
{
[Link]("Exception caught:"+e);
}
}
}
OUTPUT