예제 #1
0
 private void closeConnection() {
   Debug.println("NetScan closing connection", 5);
   try {
     if (in != null) in.close();
     if (socket != null) socket.close();
     if (serverSocket != null) {
       serverSocket.close();
     }
   } catch (IOException ioe) {
     ioe.printStackTrace();
   }
 }
예제 #2
0
 /** Creates a network scan over the specified port */
 public NetScan(TransactionId tid, TupleDesc td, int port) {
   try {
     this.tid = tid;
     this.td = td;
     this.port = port;
     serverSocket = Utilities.createServerSocket(port);
   } catch (IOException ioe) {
     ioe.printStackTrace();
     closeConnection();
     throw new RuntimeException(ioe);
   }
 }
예제 #3
0
 /** Opens this net scan. */
 public void open() throws DbException {
   try {
     if (socket == null) {
       Debug.println("NetScan accepting @ :" + port);
       socket = Utilities.accept(serverSocket);
       Debug.println("NetScan accepted, creating input stream...");
       in = new DataInputStream(socket.getInputStream());
       Debug.println("NetScan opened");
     }
   } catch (IOException ioe) {
     ioe.printStackTrace();
     closeConnection();
     throw new DbException(ioe);
   }
 }