luis901101 / zsdk

BSD 3-Clause "New" or "Revised" License
8 stars 14 forks source link

Sorry but I have this issue again. Exception when IP address is not live. #7

Closed thuutien closed 2 years ago

thuutien commented 2 years ago

Sorry to get back to you again. But I have this issue and cannot solve it. I tried your example and have the same issue. using latest zsdk, android 8.1. when I run zsdk.printZplDataOverTCPIP to send data to invalid IP (not assigned IP) after the timeout, I got this exception. How can I handle this? thanks!

I/flutter ( 9124): PlatformException(EXCEPTION, Connection timeout after 10 seconds of waiting, {errorCode: EXCEPTION, statusInfo: {status: UNKNOWN, cause: NO_CONNECTION}, settings: null, message: Connection timeout after 10 seconds of waiting}, null) W/System.err( 9124): com.zebra.sdk.comm.ConnectionException: Could not connect to device: failed to connect to /192.168.1.4 (port 9100) from /192.168.232.2 (port 40618) after 15000ms W/System.err( 9124): com.zebra.sdk.comm.ConnectionException: Could not connect to device: failed to connect to /192.168.1.4 (port 9100) from /192.168.232.2 (port 40618) after 15000ms W/System.err( 9124): at com.zebra.sdk.comm.ConnectionA.throwAsConnectionException(Unknown Source:40) W/System.err( 9124): at com.zebra.sdk.comm.ConnectionA.open(Unknown Source:37) W/System.err( 9124): at com.plugin.flutter.zsdk.ZPrinter.doPrintZplDataOverTCPIP(ZPrinter.java:335) W/System.err( 9124): at com.plugin.flutter.zsdk.ZPrinter.lambda$printZplDataOverTCPIP$16$com-plugin-flutter-zsdk-ZPrinter(ZPrinter.java:321) W/System.err( 9124): at com.plugin.flutter.zsdk.ZPrinter$$ExternalSyntheticLambda8.run(Unknown Source:8) W/System.err( 9124): at java.lang.Thread.run(Thread.java:764) W/System.err( 9124): Caused by: com.zebra.sdk.comm.ConnectionException: failed to connect to /192.168.1.4 (port 9100) from /192.168.232.2 (port 40618) after 15000ms W/System.err( 9124): at com.zebra.sdk.comm.TcpZebraConnectorImpl.open(Unknown Source:20) W/System.err( 9124): at com.zebra.sdk.comm.ConnectionA.open(Unknown Source:7) W/System.err( 9124): ... 4 more Application finished.

luis901101 commented 2 years ago

Please do not create a new ISSUE for the same issue you created before. Just reopen the former. I already answered this in the former issue. A way of handling the exception is in the example code, I even pointed the line in where you can see this. Check the former issue please