使用Socket _JAVA处理生物识别指纹考勤设备 [英] Handling Biometric Fingerprint Attendance Device by using Socket _JAVA

查看:83
本文介绍了使用Socket _JAVA处理生物识别指纹考勤设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Java程序连接生物识别指纹考勤设备(实际上我是新手!)。我使用的设备是Biocom指纹考勤系统。但是,我正在搜索和阅读有关这一点,我看到SDK可以使用基于设备类型(这很难,不合逻辑,而且,它不是全球解决方案!)



我研究了如何使用指纹设备连接,发送和检索数据的全球标准,我再也没有找到明确的解决方案。目前,我尝试通过创建套接字对象(通过以太网端口)连接设备,但也没有与我一起执行!这个开放的无限循环问题在我的头上!



总结请:



是否有任何通用的标准方法使用Java连接,发送和检索来自此类设备的数据?

Socket是否可以考虑解决此类问题?

如果是,请问,我的代码有什么问题,除了主机IP和端口号需要什么更多东西才能与设备连接?



使用的套接字代码:

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







对不起这个长问题很抱歉。但是任何提示都将受到赞赏!




Sorry for this long question. BUT any Hint will be appreciated!

推荐答案

请不要在多个论坛中发布相同的问题。我已经在Java论坛中对此做出了回应。
Please do not post the same question in multiple forums. I already responded to this in the Java forum.


这篇关于使用Socket _JAVA处理生物识别指纹考勤设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆