Zebra打印机连接失败“读取失败,套接字可能关闭或超时,读取ret:-1" [英] Zebra printer connection failed “read failed, socket might closed or timeout, read ret: -1”

查看:2041
本文介绍了Zebra打印机连接失败“读取失败,套接字可能关闭或超时,读取ret:-1"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

"java.io.IOException:读取失败,套接字可能关闭或超时,读取ret:-1"异常,当我试图通过蓝牙将android设备与Zebra ZD410打印机连接时.

"java.io.IOException: read failed, socket might closed or timeout, read ret: -1" exception appears while i'm trying to connect my android device with Zebra ZD410 printer through bluetooth.

        try {
            mmSocket.connect();
        } catch (IOException e1) {
            android.util.Log.e(TAG, e1.toString());

            try {
                android.util.Log.i(TAG, "Trying fallback...");
                mmSocket =(BluetoothSocket) mmDevice.getClass().getMethod("createRfcommSocket", new Class[] {int.class}).invoke(mmDevice,1);
                mmSocket.connect();
                android.util.Log.i(TAG, "Connected");
            } catch (Exception e2) {
                android.util.Log.e(TAG, "Couldn't establish Bluetooth connection!");
                try {
                    mmSocket.close();
                } catch (IOException e3) {
                    android.util.Log.e(TAG, "unable to close() " + mSocketType + " socket during connection failure", e3);
                }
                connectionFailed();
                return;
            }
        }

我已经尝试了使用后备套接字连接的解决方案,但是没有帮助.此代码与Epson打印机和其他设备兼容,但不适用于zebra ZD410打印机.可能是什么原因?

I already tried solution with fallback socket connection but it didn't helped. This code works well with Epson printer and some other devices, but not with zebra ZD410 printer. What can be a reason?

推荐答案

我收到了Zebra支持的回复.我的Zebra打印机仅支持Bluetooth LE,解决方案是使用具有蓝牙经典功能的打印机.

I received a response from Zebra support. My Zebra printer supports only Bluetooth LE, solution is to use printer with bluetooth classic capabilities.

ZD410的SKU表示仅使用Bluetooth LE的打印机是ZD4xxxx-xxx $ xxxx,其中$是E,F,M或S.BluetoothLE不足以使Android设备能够连接并打印到打印机. 为了能够从Android设备通过蓝牙进行连接和打印,打印机需要具备蓝牙经典功能. 除了蓝牙LE之外,ZD410的SKU表示蓝牙经典功能还包括ZD4xxxx-xxx $ xxxx,其中$是A,B,L或W.

SKUs of the ZD410 that indicate a Bluetooth LE only printer are ZD4xxxx-xxx$xxxx where $ is E, F, M, or S. Bluetooth LE is not a sufficient connection for an Android device to connect and print to the printer. In order to be able to connect and print via Bluetooth from an Android device, the printer would require Bluetooth Classic capabilities. SKUs of the ZD410 that indicate a Bluetooth Classic capabilities in addition to Bluetooth LE are ZD4xxxx-xxx$xxxx where $ is A, B, L, or W.

这篇关于Zebra打印机连接失败“读取失败,套接字可能关闭或超时,读取ret:-1"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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