lsongdev / lsongdev/node-escpos

ECONNREFUSED when printing by network

オープン
#421 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
TypeScript
スター
1.6k
フォーク
443
PR マージ指標
30日以内にマージされた PR はありません

説明

USB interface tested and worked.

But I'm getting this error while trying to print by Network interface:

```
Error: connect ECONNREFUSED 192.168.1.119:9100
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1487:16) {
errno: -61,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '192.168.1.119',
port: 9100
}
```

Ping to printer:

```
➜ ~ ping 192.168.1.119
PING 192.168.1.119 (192.168.1.119): 56 data bytes
64 bytes from 192.168.1.119: icmp_seq=0 ttl=64 time=6.388 ms
64 bytes from 192.168.1.119: icmp_seq=1 ttl=64 time=7.135 ms
64 bytes from 192.168.1.119: icmp_seq=2 ttl=64 time=5.781 ms
64 bytes from 192.168.1.119: icmp_seq=3 ttl=64 time=7.053 ms
^C
--- 192.168.1.119 ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 5.781/6.589/7.135/0.549 ms
```

Code:

```
const escpos = require('escpos');
escpos.Network = require('escpos-network');

const netPrint = (ip: string, text: string, encode: string, fontSize: number, port: number) => {
const device = new escpos.Network(ip, port);

const options = { encoding: 'GB18030' };
const printer = new escpos.Printer(device, options);

device.open(function (err: unknown) {
if (err) {
console.log(err);
return;
}

printer
.font('B')
.align('LT')
.style('NORMAL')
.size(fontSize, fontSize)
.marginBottom(1)
.encode(encode)
.text(text + '\n\n')
.cut()
.close();
});
};

export default netPrint;

```

Anyone had this problem??

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Start with the supplied escpos.Network(ip, port) call and the ECONNREFUSED connection to 192.168.1.119:9100. Reproduce the network-printing path and compare it with the working USB path; done means determining whether the failure is in the library or the printer/network endpoint.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
nodejs, typescript
領域
networking
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。