title: Communicate and Download data from attendance Machine in LAN with JAVA
body: <p>I am trying to make an API to read from attendance machine. I find the port from which it is communicating and made successfull connection to it by Java Socket Programming. Now I am trying to get data from it but don't know how to do it. I tried buffered reader and input stream method and redline() but still it does not read anything and then gives errors as connection reset.</p>
  
  <p>Here is my code... If anyone can help.</p>
  
  <pre><code>     &lt;%@page import="java.net.*"%&gt;
      &lt;%@page import="java.io.*"%&gt;
  
      &lt;%
  
      String host = "IP of Machine";
      int port = Integer.parseInt("Port from it is communicating");
  
      try {
          Socket socket = new Socket(host, port);
          BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
  
          String line;
  
          while(true){
  
              line = in.readLine();
  
  
                  if (line != null){
  
                  System.out.println(line.toString());
              }
          }
      } catch (UnknownHostException e) {
          e.printStackTrace();
  
  } catch (IOException e) {
      e.printStackTrace();
  }
  %&gt;
  </code></pre>
  
  <p>I checked some other SDKs and found that it reads from general log of machine, but i am not able to find log or don't know where to find the log.</p>