esc_pos_printer icon indicating copy to clipboard operation
esc_pos_printer copied to clipboard

[ binding] Print result: Error. Printer connection timeout

Open yogithesymbian opened this issue 1 year ago • 0 comments

Print result: Error. Printer connection timeout on example guide / code its get by Wifi dependency to get local ipaddress. but we know its deprecated , so i set manuallt cause i know my ip address is 192.168.43.9 . i make sure its correct by adb connect 192.168.43.9 and adb devices


List of devices attached
192.168.43.9:5555       device

and sometimes looks like these
➜  example git:(master) ✗ adb devices
List of devices attached
V222219J21230   device

i try to connect but getting error like as the mention . i just want to connect my print device ( 192.168.43.9 ) with my normal phone thats connect same wireless ( hotspot wifi ) .

my hotspot wifi is ( 192.168.43.1 ) also i can connect by adb connect

i have tested by

  1. from my print device to my print device ( not work )
  2. from my normal device to my print device ( not work )

the code is copy from main.dart from example

const PaperSize paper = PaperSize.mm80;
    final profile = await CapabilityProfile.load();
    final printer = NetworkPrinter(paper, profile);

    final PosPrintResult res =
        await printer.connect('192.168.43.9', port: 9100);

    if (res == PosPrintResult.success) {
      testReceipt(printer);
      printer.disconnect();
    }

    print('Print result: ${res.msg}');

here is dependency

  # others
  esc_pos_printer: ^4.1.0
  charset_converter: ^2.1.1
  image: ^3.0.2
  intl: ^0.18.1
  path_provider: ^2.0.15
  ping_discover_network_forked: ^0.0.1
  qr_flutter: ^4.0.0
  # network_info_plus: 3.0.2 # i change for wifi cause deprecated

yogithesymbian avatar Jun 20 '23 00:06 yogithesymbian