Hai,
           I writen a program to print the time on particular Domain. But it
is not working prop. How to Run it what's the error (s)?




thnx,

rajavelu

---------------------------------------------------
Quark Media House (I) Pvt Ltd.,
Chandigarh
India
---------------------------------------------------
import java.io.*;
import java.net.*;

public class Exp1
{
  public static void main(String str[])
  {
        Socket mySocket;
        String host = "nrajavelu";
	
        if(str.length > 0)
        {
                host = str[0];
        }
	
        try
        {
          mySocket = new Socket(host,13);
          BufferedReader in = new BufferedReader(new InputStreamReader(mySocket.getInputStream()));
          String time = in.readLine();
          System.out.println("The Time on the Host "+host+" is "+time);
        }
        catch(UnknownHostException e)
        {
          System.out.println("Sorry Host not Found.!");
        }
	
        catch(IOException e)
        {
          System.out.println("Could not open Socket.!");
        }
  }
}

Reply via email to