2
我的查詢是我有一臺打印機連接到以太網,並且能夠使用打印機的IP地址打印到該打印機,但問題是打印機停止用於打印的線條結束,因此紙張卡在打印機中。使用具有特定IP地址的打印機在Android中打印
我的代碼:
try {
Socket sock = new Socket("192.168.0.131", 9100);
PrintWriter oStream = new PrintWriter(sock.getOutputStream());
oStream.println("HI,test from Android Device");
oStream.println("\n\n\n");
oStream.close();
sock.close();
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}