I am trying to connect with a Biometric Fingerprint Attendance Device using a Java Program (actually I am newbie in that!). 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 infinity loop problems on my head!
In sum please:
Is there any general, standard way to connect, send and retrieve data from such device using Java?
Is a Socket can consider as a solution for such problem?
If yes please, what is the wrong in my code below, what additional things needed more than the host ip and port number to connect with Device?
The Socket code that used:
public class Requester {
Socket requestSocket;
ObjectOutputStream out;
ObjectInputStream in;
String message;
Requester() {
}
void run() throws IOException {
try {
requestSocket = new Socket("192.168.0.19", 4370);
System.out.println("Connected to given host in port 4370");
in = new ObjectInputStream(requestSocket.getInputStream());
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();
}
}
Sorry for this long question. BUT any Hint will be appreciated!