1
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"git.rosy.net.cn/jx-print/globals"
|
||||
"io"
|
||||
"net"
|
||||
"strings"
|
||||
@@ -59,8 +60,17 @@ func handleConn(c net.Conn) error {
|
||||
}
|
||||
for {
|
||||
buffer, n, err := ConnRead(c)
|
||||
|
||||
remoteAddr := c.RemoteAddr().(*net.TCPAddr)
|
||||
remoteIP := remoteAddr.IP.String() // 打印机IP
|
||||
remotePort := remoteAddr.Port // 打印机端口
|
||||
globals.SugarLogger.Debugf("remoteIP1: %s", remoteIP)
|
||||
globals.SugarLogger.Debugf("remotePort1: %d", remotePort)
|
||||
|
||||
printRemoteAddr := c.RemoteAddr().String()
|
||||
printRemoteAddr = strings.Split(printRemoteAddr, ":")[0]
|
||||
globals.SugarLogger.Debugf("printRemoteAddr2: %s", printRemoteAddr)
|
||||
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
fmt.Println("connection close")
|
||||
|
||||
Reference in New Issue
Block a user