4

I am trying to connect with a Biometric Fingerprint Attendance Device using a Java program. The device I am using is a Biocom Fingerprint attendance system. However, I am search and reading about that and I see the SDK could used which based on device type (which hard, not logical, moreover, it is not global solution!)

I research for a global standard on how to connect, send and retrieve data with a Fingerprint Device which again I wasn't lucky enough to find a clear solution. Currently, I tried to connect with the device by creating a Socket object (through Ethernet port) but also not executed with me. This open infinite loop problems on my head.

  • Is there any general, standard way to connect, send and retrieve data from such device using Java?
  • Can a Socket be considered as a solution for such problem?
  • If yes, what is wrong in my code below? What additional things more than the host IP and port number are needed to connect with the device?

The Socket code that used:

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;
import java.net.UnknownHostException;

public class Requester {
Socket requestSocket;
ObjectOutputStream out;
ObjectInputStream in;
String message;

Requester() {
}

void run() throws IOException {
    try {
        // 1. creating a socket to connect to the server
        requestSocket = new Socket("192.168.0.19", 4370);
        System.out.println("Connected to given host in port 4370");
        // 2. get Input and Output streams
        in = new ObjectInputStream(requestSocket.getInputStream());
        // 3: Communicating with the server
        String line;
        while (true) {
            line = in.readLine();
            if (line != null) {
                System.out.println(line);
            }
        }
    } catch (UnknownHostException unknownHost) {
        System.err.println("You are trying to connect to an unknown host!");

    } catch (IOException ioException) {
        ioException.printStackTrace();

    } catch (Exception Exception) {
        Exception.printStackTrace();

    } finally {
        in.close();
        requestSocket.close();
    }
}

void sendMessage(String msg) {
    try {
        out.writeObject(msg);
        out.flush();
        System.out.println("client: " + msg);

    } catch (IOException ioException) {
        ioException.printStackTrace();
    }
}

public static void main(String args[]) throws IOException {
    Requester client = new Requester();
    client.run();
}
}

This image may give more details:

4
  • So... how is the application behaving? Is it throwing some exceptions? Is it not reading anything? Jun 2, 2014 at 9:23
  • yes please, it is not reading anything! it's stop after this line in = new ObjectInputStream(requestSocket.getInputStream()); !! which means it isn't reach the device (maybe)! Jun 2, 2014 at 9:31
  • An ObjectInputStream deserializes primitive data and objects previously written using an ObjectOutputStream. You realize that the data you're trying to receive wasn't serialized by an ObjectOutputStream and therefore will not receive the correct input, Try wrapping it in a more generic InputStream such as a simple BufferedReader: BufferedReader reader = new BufferedReader(new InputStreamReader(requestSocket.getInputStream())) Jun 2, 2014 at 13:12
  • thanks, BUT really I tried that but without hope :( (!) what is the problem I don't know moreover I am stuck for along of time without any progress!! there is no any tutorial, really infinity depressed (moreover there is no one who can I ask :( ) ! @TFC Jun 3, 2014 at 5:52

2 Answers 2

1

You don't need the ObjectInputStream. Just use the InputStream you get from requestSocket.getInputStream().

Alternatively use a terminal programm like putty to connect to your device. This requires no coding.

2
  • thanks for your answer, I change the code like [ in = requestSocket.getInputStream(); inputS = new BufferedInputStream(in); System.out.println(inputS.toString()); ] and get the result which (java.io.BufferedInputStream@190d11) which I do not understand, Is that what do you mean please?! Jun 2, 2014 at 9:52
  • System.out.println(inputS.toString()); This will print the BufferedInputStream object toString, you'll need to wrap it in a reader of sorts. Jun 2, 2014 at 13:15
0

Biocom Biometrics are ZKTeco devices. ZkTeco devices are launched only with windows SDK. You can download the SDK from https://www.zkteco.com/en/download_catgory.html and use the DLL in java which can run only on Windows platorm. For HTTP communication, to work in any platform through any language, refer http://camsunit.com/application/zk-teco-essl-api-integration.html

1
  • Yes, it is chargeable. Manufactures always give Online API as license based.
    – Ravanan
    Aug 29, 2020 at 3:04

Not the answer you're looking for? Browse other questions tagged or ask your own question.