0

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.

Here is my code... If anyone can help.

     <%@page import="java.net.*"%>
    <%@page import="java.io.*"%>

    <%

    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();
}
%>

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.

jatz2012
  • 31
  • 9
  • AFAIK attendance machines either stores on local memory (on the machine) or it integrates with a software that is installed on a PC or server and dumps data in a file or database on that PC, however i think you need some kind of commands to request certain data from the attendance machine, connecting to it is a thing and pulling data is another, so you may want to look for some kind of commands for that – Yazan Mar 24 '16 at 07:46
  • @Yazan yes bro i know it is another thing but that is what i want to do...I have read some SDKs of other machines and also some freeware available for other languages like c# or .net. They download data directly from the Machine. Do you know where to start for the same.? – jatz2012 Mar 24 '16 at 07:49
  • sorry i don't know any, but what happen if you open that IP:PORT in a regular browser? i mean `http://IP:PORT` ? this could be of some help – Yazan Mar 24 '16 at 07:53
  • It says no data received....:) – jatz2012 Mar 24 '16 at 07:55
  • can you share the machine brand/model? i may try to search for something – Yazan Mar 24 '16 at 08:07
  • It is of BioFinger VX1.0. – jatz2012 Mar 24 '16 at 08:15
  • 1
    @Yazan i got the API named ZKTime which helped me connect to the machine and reading data...Thanks.. – jatz2012 Feb 20 '17 at 11:09
  • Where do I get this sdk? – Martin Karari Dec 02 '18 at 20:11

0 Answers0