Symbian
Symbian OS Library

FAQ-0761 How do I force a phone to connect to the Internet from Java code?

[Index][spacer] [Previous] [Next]



 

Classification: Java Category: java.net
Created: 01/09/2002 Modified: 01/09/2002
Number: FAQ-0761
Platform: ER5, Symbian OS v6.0, Symbian OS v6.1

Question:
In a pJava application running on Symbian OS, if no Internet connection exists, one is made (or at least a "Connect to Internet" dialog is launched) when a socket is opened. Is it possible to force an Internet connection to be made any other way?

Answer:
There is no pJava API provided which does this directly. The easiest way to force an Internet connection to be made if you don't need to open a socket for immediate use is the following:
    try
    {
    (new java.net.ServerSocket(80)).close();
    }
    catch (Exception e) {}