/* Server_Slip14_1*/
import java.net.*;
import java.io.*;
importjava.util.Date;
public class Server_Slip14_1
{
public static void main(String g[])throws UnknownHostException, IOException
{
ServerSocketss=new ServerSocket(4444);
System.out.println("server started");
Socket s=ss.accept();
System.out.println("Client connected");
Date d=new Date();
int m=d.getMonth();
m=m+1;
int y=d.getYear();
y=y+1900;
String time=""+d.getHours()+":"+d.getMinutes()+":"+d.getSeconds()+" Date is
"+d.getDate()+"/"+m+"/"+y;
OutputStreamos=s.getOutputStream();
DataOutputStream dos=new DataOutputStream(os);
dos.writeUTF(time);
}
}
/* client_Slip14_1*/
import java.net.*;
import java.io.*;
importjava.util.*;
public class Client_Slip14_1
{
public static void main(String args[]) throws Exception
{
Socket s = new Socket("localhost",4444);
DataInputStream dos = new DataInputStream(s.getInputStream());
String time = dos.readUTF();
System.out.println("Current date and time is "+time);
}
}