This commit is contained in:
邹宗楠
2026-05-12 17:00:36 +08:00
parent 29634ad17f
commit f2ce2db029
2 changed files with 17 additions and 16 deletions

View File

@@ -747,22 +747,22 @@ func doPrint(t *TcpClient, key string) (err error) {
}
// 链接已经关闭了
if isClosed(c) {
remoteAddr := c.RemoteAddr().(*net.TCPAddr)
remoteIP := remoteAddr.IP.String() // 打印机IP
remotePort := remoteAddr.Port // 打印机端口
globals.SugarLogger.Debugf("remoteIP3: %s", remoteIP)
globals.SugarLogger.Debugf("remotePort3: %d", remotePort)
printRemoteAddr := c.RemoteAddr().String()
printRemoteAddr = strings.Split(printRemoteAddr, ":")[0]
globals.SugarLogger.Debugf("printRemoteAddr3: %s", printRemoteAddr)
c = reconnectPrinter(c)
if c != nil {
t.setPrintConn(printMsg.PrintNo, c)
}
}
//if isClosed(c) {
// remoteAddr := c.RemoteAddr().(*net.TCPAddr)
// remoteIP := remoteAddr.IP.String() // 打印机IP
// remotePort := remoteAddr.Port // 打印机端口
// globals.SugarLogger.Debugf("remoteIP3: %s", remoteIP)
// globals.SugarLogger.Debugf("remotePort3: %d", remotePort)
//
// printRemoteAddr := c.RemoteAddr().String()
// printRemoteAddr = strings.Split(printRemoteAddr, ":")[0]
// globals.SugarLogger.Debugf("printRemoteAddr3: %s", printRemoteAddr)
//
// c = reconnectPrinter(c)
// if c != nil {
// t.setPrintConn(printMsg.PrintNo, c)
// }
//}
if _, err = c.Write(data); err != nil {
globals.SugarLogger.Debugf("handleTcpMessages err [%v]", err)
} else {