Tam Sürümünü Görmek İçin : JAVA da dos komutları?
JAVA da DOS komutlarını nasıl kullanabilirim.
darky_dark
30/04/2003, 08:01
asagida da dos uzerinden istenen 1 hostu ping leyen 1 kod var..
..................................
String hostAddress, pingCount, timeoutValue;
String tempStr = "";
hostAddress = destHost.hostAddress;
pingCount = "-n " + destHost.pingCount;
timeoutValue = " -w " + destHost.timeoutValue;
String pingCommand = "ping " + pingCount + timeoutValue + " " + hostAddress;
Process pingProcess = Runtime.getRuntime().exec(pingCommand);
InputStream inStream = pingProcess.getInputStream();
BufferedReader bReader = new BufferedReader(new InputStreamReader(inStream));
String resultLine = "";
String errStr = "seems OK";
int countTimeOut = 0;
while ((resultLine = bReader.readLine()) != null)
{
System.out.println(resultLine);
}
pingProcess.waitFor();
// pingProcess.destroy();
bReader.close();
...................................
sevgi, saygi..
_DD_
Forum Yazılımı : vBulletin v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.