• Post Reply Bookmark Topic Watch Topic
  • New Topic

connect to Internet using modem and dial up connection

 
cognizant
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i found the following code in java ranch april forum...
i am usng win 2000 i am able to run the java code but i am not getting any response...modem is also connected but no respose...pl guide me thru

**********************
Somewhere else I found this solution. It ain't pretty but it works (bye bye platform independence)
try{
String connName = ""; // fill out your connection name
String myUsername = ""; // fill out your username
String myPasswrd = ""; // fill out your password
Properties props = System.getProperties();
String osName = props.getProperty("os.name");
String command = "";
if(osName.equals("Windows Me")||osName.equals("Windows 98")||osName.equals("Windows 95")){
command = "start /wait C:\\Windows\\Rundll32.exe rnaui.dll,RnaDial ";
}
if(osName.equals("Windows NT")){
command = "RASDIAL.EXE ";
}
command = command + myConnName + myUsername + myPasswrd;
Process p = Runtime.getRuntime().exec(command);
p.waitFor();
}
catch (Exception e){
System.out.println(e.getMessage());
}
You can disconnect by calling rasdial /p.
****************
 
Lewin Chan
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just a small thing,
Have you noticed how there's no osName condition for windows 2000?, you should be able to use rasdial on win2k
Also you might want to make sure that there are spaces in between the commands so that the full commandline is
"rasdial myConnection myUser myPassword"
L
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!