import java.net.*;
import java.io.*;
class pings {
public static void main (String args[])
{
if ( args.length <= 0 ) {
// argument has to be passed!!
System.out.println("Usage java pings IPAddress(String) Port(Integer) ");
System.exit(1);
}
try
{
Socket localSocket = new Socket (args[0], Integer.parseInt(args[1]));
localSocket.setSoTimeout(1000);
System.err.println ("Server status: Connected");
localSocket.close ();
}
catch (IOException e)
{
System.err.println ("Server status: DOWN");
System.exit(1);
}
}
}
import java.io.*;
class pings {
public static void main (String args[])
{
if ( args.length <= 0 ) {
// argument has to be passed!!
System.out.println("Usage java pings IPAddress(String) Port(Integer) ");
System.exit(1);
}
try
{
Socket localSocket = new Socket (args[0], Integer.parseInt(args[1]));
localSocket.setSoTimeout(1000);
System.err.println ("Server status: Connected");
localSocket.close ();
}
catch (IOException e)
{
System.err.println ("Server status: DOWN");
System.exit(1);
}
}
}
No comments:
Post a Comment