static void fun() {
    PrintStream toSoc;

    try {
      ServerSocket f = new ServerSocket(9090);
      while (true) {
        Socket t = f.accept();
        BufferedReader fromSoc = new BufferedReader(new InputStreamReader(t.getInputStream()));
        String video = fromSoc.readLine();
        System.out.println(video);
        searcher obj = new searcher();
        boolean fs;
        fs = obj.search(video);
        if (fs == true) {
          System.out.println("stream will starts");
          toSoc = new PrintStream(t.getOutputStream());
          toSoc.println("stream starts");

        } else {
          toSoc = new PrintStream(t.getOutputStream());
          toSoc.println("sorry");
        }
      }

    } catch (Exception e) {
      System.out.println(e);
    }
  }
  public static void main(String args[]) {
    int myport = 9090;
    Socket s;
    ServerSocket ss;
    BufferedReader fromSoc, fromKbd;
    PrintStream toSoc;
    String line, msg;
    try {
      s = new Socket("169.254.63.10", 6016);
      System.out.println("enter line");
      System.out.println("connected");
      toSoc = new PrintStream(s.getOutputStream());

      toSoc.println(myport);
      String url =
          "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)}; DBQ=D://db.mdb; DriverID=22;READONLY=true;";

      Connection con = DriverManager.getConnection(url, "", "");
      Statement st = con.createStatement();
      String ip = "169.254.63.10";
      int port = 6016;
      String video = "rooney";

      st.executeUpdate(
          " insert into p3 values('" + ip + "' , '" + port + "' , '" + video + "' );  ");

      fun();

    } catch (Exception e) {

      System.out.println("exception" + e);
    }
  }
 private void saveSqlScript(String fileName, String[] sql) throws FileNotFoundException {
   FileOutputStream fileOutputStream = new FileOutputStream(fileName);
   PrintStream printStream = new PrintStream(fileOutputStream);
   for (int i = 0; i < sql.length; i++) {
     printStream.println(sql[i] + getSqlDelimiter());
   }
 }
Beispiel #4
0
 public void toFile(String file) {
   try {
     PrintStream ps = new PrintStream(new FileOutputStream(file), true);
     ps.print(sw.toString());
   } catch (Exception e) {
     System.err.println(e.toString());
   }
 }
Beispiel #5
0
 public static void printKeyValues(String k, List<String> v, PrintStream ps) {
   ps.print(k + " => ");
   boolean first = true;
   for (String val : v) {
     if (!first) {
       ps.print(", ");
     }
     first = false;
     ps.print(val);
   }
   ps.println();
 }
Beispiel #6
0
 public static synchronized void printDebugMsg(PrintStream out) {
   if (DEBUG == false) {
     return;
   }
   StringBuffer msg = new StringBuffer();
   msg.append("debug message in " + SimpleConnectionPool.class.getName());
   msg.append("\r\n");
   msg.append("total count is connection pool: " + getConnectionCount());
   msg.append("\r\n");
   msg.append("not used connection count: " + getNotUsedConnectionCount());
   msg.append("\r\n");
   msg.append("used connection, count: " + getUsedConnectionCount());
   out.println(msg);
   Iterator iterator = m_usedUsedConnection.iterator();
   while (iterator.hasNext()) {
     ConnectionWrapper wrapper = (ConnectionWrapper) iterator.next();
     wrapper.debugInfo.printStackTrace(out);
   }
   out.println();
 }
Beispiel #7
0
 /**
  * ** Encodes the specified DBRecordKyes into XML and writes it to ** a specified PrintStream
  * ** @param out The PrintStream ** @param dbrk The list of DBRecordKeys
  */
 public static void printXML(PrintStream out, DBRecordKey... dbrk) {
   if (out != null) {
     DBRecordKey.printXML(new PrintWriter(out), dbrk);
     out.flush();
   }
 }