KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > javax > microedition > io > Connection

javax.microedition.io
Interface Connection

All Known Subinterfaces:
ContentConnection, DatagramConnection, HttpConnection, InputConnection, OutputConnection, StreamConnection, StreamConnectionNotifier
See Also:
Top Examples, Source Code

public void close()
           throws IOException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[1906]open and return a connection
By iqueen on 2007/08/02 23:39:53  Rate
private static final int CONN_RETRY = 3; 
 private Connection connection; 
 /** 
      * open connection 
      *  
      * @param URL 
      *  
      * @return 
      * @throws IOException 
      */
 
     private Connection openConn ( String URL )  throws IOException  {  
         this.connection = null; 
         for  ( int i = 0; i  <  CONN_RETRY; i++ )   {  
             try  {  
                 connection = Connector.open ( URL ) ; 
                 this.connected = true; 
                 break; 
              }  catch  ( ConnectionNotFoundException e )   {  
                 appendLog ( e ) ; 
                 throw e; 
              }  catch  ( SecurityException e )   {  
                 appendLog ( e ) ; 
                 break; 
              }  
          }  
         return connection; 
      }  
  
  
     public void appendLog ( Exception es )   {  
   //TODO handle exception 
      } 

Popular Tags