You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to implement the TCP Printing to Network Printer however getting exception com.dantsu.escposprinter.exceptions.EscPosConnectionException: Unable to connect to TCP device.
Can you please suggest me any solutions.
Thank you.
java.net.SocketTimeoutException: failed to connect to /192.168.0.118 (port 9100) from /192.168.0.114 (port 43314) after 15ms
2024-11-13 13:08:42.093 17509-17811 System.err com.myapp W at libcore.io.IoBridge.connectErrno(IoBridge.java:235)
2024-11-13 13:08:42.093 17509-17811 System.err com.myapp W at libcore.io.IoBridge.connect(IoBridge.java:179)
2024-11-13 13:08:42.093 17509-17811 System.err com.myapp W at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:142)
2024-11-13 13:08:42.094 17509-17811 System.err com.myapp W at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:390)
2024-11-13 13:08:42.094 17509-17811 System.err com.myapp W at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:230)
2024-11-13 13:08:42.095 17509-17811 System.err com.myapp W at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:212)
2024-11-13 13:08:42.096 17509-17811 System.err com.myapp W at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:436)
2024-11-13 13:08:42.096 17509-17811 System.err com.myapp W at java.net.Socket.connect(Socket.java:646)
2024-11-13 13:08:42.097 17509-17811 System.err com.myapp W at com.dantsu.escposprinter.connection.tcp.TcpConnection.connect(TcpConnection.java:63)
2024-11-13 13:08:42.098 17509-17811 System.err com.myapp W at com.dantsu.escposprinter.connection.tcp.TcpConnection.connect(TcpConnection.java:12)
2024-11-13 13:08:42.098 17509-17811 System.err com.myapp W at com.dantsu.escposprinter.EscPosPrinterCommands.connect(EscPosPrinterCommands.java:311)
2024-11-13 13:08:42.099 17509-17811 System.err com.myapp W at com.dantsu.escposprinter.EscPosPrinter.(EscPosPrinter.java:54)
2024-11-13 13:08:42.100 17509-17811 System.err com.myapp W at com.dantsu.escposprinter.EscPosPrinter.(EscPosPrinter.java:27)
2024-11-13 13:08:42.101 17509-17811 System.err com.myapp W at com.myapp.Fragments.PrintFragment$3.run(PrintFragment.java:295)
2024-11-13 13:08:42.101 17509-17811 System.err com.myapp W at java.lang.Thread.run(Thread.java:1012)
2024-11-13 13:08:42.102 17509-17811 System.err com.myapp W com.dantsu.escposprinter.exceptions.EscPosConnectionException: Unable to connect to TCP device.
2024-11-13 13:08:42.102 17509-17811 System.err com.myapp W at com.dantsu.escposprinter.connection.tcp.TcpConnection.connect(TcpConnection.java:69)
2024-11-13 13:08:42.102 17509-17811 System.err com.myapp W at com.dantsu.escposprinter.connection.tcp.TcpConnection.connect(TcpConnection.java:12)
2024-11-13 13:08:42.103 17509-17811 System.err com.myapp W at com.dantsu.escposprinter.EscPosPrinterCommands.connect(EscPosPrinterCommands.java:311)
2024-11-13 13:08:42.103 17509-17811 System.err com.myapp W at com.dantsu.escposprinter.EscPosPrinter.(EscPosPrinter.java:54)
2024-11-13 13:08:42.103 17509-17811 System.err com.myapp W at com.dantsu.escposprinter.EscPosPrinter.(EscPosPrinter.java:27)
2024-11-13 13:08:42.104 17509-17811 System.err com.myapp W at com.myapp.Fragments.PrintFragment$3.run(PrintFragment.java:295)
2024-11-13 13:08:42.104 17509-17811 System.err com.myapp W at java.lang.Thread.run(Thread.java:1012)
The text was updated successfully, but these errors were encountered:
Hello @DantSu,
I tried to implement the TCP Printing to Network Printer however getting exception com.dantsu.escposprinter.exceptions.EscPosConnectionException: Unable to connect to TCP device.
Can you please suggest me any solutions.
Thank you.
Code
private void print() {
new Thread(new Runnable() {
public void run() {
try {
EscPosPrinter printer = new EscPosPrinter(new TcpConnection("192.168.1.5", 9100, 15), 203, 48f, 32);
printer.printFormattedText(
"[L]\n" +
"[C]ORDER N°045\n" +
"[L]\n" +
"[C]================================\n" +
"[L]\n" +
"[L]BEAUTIFUL SHIRT[R]9.99e\n" +
"[L] + Size : S\n" +
"[L]\n" +
"[L]AWESOME HAT[R]24.99e\n" +
"[L] + Size : 57/58\n" +
"[L]\n" +
"[C]--------------------------------\n" +
"[R]TOTAL PRICE :[R]34.98e\n" +
"[R]TAX :[R]4.23e\n" +
"[L]\n" +
"[C]================================\n" +
"[L]\n" +
"[L]Customer :\n" +
"[L]Raymond DUPONT\n" +
"[L]5 rue des girafes\n" +
"[L]31547 PERPETES\n" +
"[L]Tel : +33801201456\n" +
"[L]\n" +
"[C]831254784551\n" +
"[C]https://dantsu.com/"
);
} catch (Exception e) {
Log.e(TAG, "Inside IP Print Exception: " + e);
e.printStackTrace();
}
}
}).start();
}
Error
java.net.SocketTimeoutException: failed to connect to /192.168.0.118 (port 9100) from /192.168.0.114 (port 43314) after 15ms
2024-11-13 13:08:42.093 17509-17811 System.err com.myapp W at libcore.io.IoBridge.connectErrno(IoBridge.java:235)
2024-11-13 13:08:42.093 17509-17811 System.err com.myapp W at libcore.io.IoBridge.connect(IoBridge.java:179)
2024-11-13 13:08:42.093 17509-17811 System.err com.myapp W at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:142)
2024-11-13 13:08:42.094 17509-17811 System.err com.myapp W at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:390)
2024-11-13 13:08:42.094 17509-17811 System.err com.myapp W at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:230)
2024-11-13 13:08:42.095 17509-17811 System.err com.myapp W at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:212)
2024-11-13 13:08:42.096 17509-17811 System.err com.myapp W at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:436)
2024-11-13 13:08:42.096 17509-17811 System.err com.myapp W at java.net.Socket.connect(Socket.java:646)
2024-11-13 13:08:42.097 17509-17811 System.err com.myapp W at com.dantsu.escposprinter.connection.tcp.TcpConnection.connect(TcpConnection.java:63)
2024-11-13 13:08:42.098 17509-17811 System.err com.myapp W at com.dantsu.escposprinter.connection.tcp.TcpConnection.connect(TcpConnection.java:12)
2024-11-13 13:08:42.098 17509-17811 System.err com.myapp W at com.dantsu.escposprinter.EscPosPrinterCommands.connect(EscPosPrinterCommands.java:311)
2024-11-13 13:08:42.099 17509-17811 System.err com.myapp W at com.dantsu.escposprinter.EscPosPrinter.(EscPosPrinter.java:54)
2024-11-13 13:08:42.100 17509-17811 System.err com.myapp W at com.dantsu.escposprinter.EscPosPrinter.(EscPosPrinter.java:27)
2024-11-13 13:08:42.101 17509-17811 System.err com.myapp W at com.myapp.Fragments.PrintFragment$3.run(PrintFragment.java:295)
2024-11-13 13:08:42.101 17509-17811 System.err com.myapp W at java.lang.Thread.run(Thread.java:1012)
2024-11-13 13:08:42.102 17509-17811 System.err com.myapp W com.dantsu.escposprinter.exceptions.EscPosConnectionException: Unable to connect to TCP device.
2024-11-13 13:08:42.102 17509-17811 System.err com.myapp W at com.dantsu.escposprinter.connection.tcp.TcpConnection.connect(TcpConnection.java:69)
2024-11-13 13:08:42.102 17509-17811 System.err com.myapp W at com.dantsu.escposprinter.connection.tcp.TcpConnection.connect(TcpConnection.java:12)
2024-11-13 13:08:42.103 17509-17811 System.err com.myapp W at com.dantsu.escposprinter.EscPosPrinterCommands.connect(EscPosPrinterCommands.java:311)
2024-11-13 13:08:42.103 17509-17811 System.err com.myapp W at com.dantsu.escposprinter.EscPosPrinter.(EscPosPrinter.java:54)
2024-11-13 13:08:42.103 17509-17811 System.err com.myapp W at com.dantsu.escposprinter.EscPosPrinter.(EscPosPrinter.java:27)
2024-11-13 13:08:42.104 17509-17811 System.err com.myapp W at com.myapp.Fragments.PrintFragment$3.run(PrintFragment.java:295)
2024-11-13 13:08:42.104 17509-17811 System.err com.myapp W at java.lang.Thread.run(Thread.java:1012)
The text was updated successfully, but these errors were encountered: