Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

connect to Internet using modem and dial up connection  RSS feed

 
Ruud Steeghs
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I've developed an application which works just fine when an open Internet connection is available (using HttpUrlConnection and HttpsUrlConnection). Now I'm looking for possibilities to connect to the Internet using a modem and dial up-connection.
At some point I want my application to connect to the Internet using a modem and also hang up automatically. Is this possible? Which Java API's to use?
Platform is Windows NT. Do I have to communicate with windows 'dial up connection'?
Any help would be appreciated.
Cheers,
-Ruud.
 
tommorow never comes
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi dear..
i also have same problem , i also want to make application by which i can communicate without using internet..
i saw this project in VB..
i think we have to call some windows API..by using native method..to comunicate to the
low level service....
 
Ruud Steeghs
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Cheers,
-Ruud.
SCJP, SCJD ;-)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!