如何连接在Android的网络打印机? [英] How to connect a network printer over Android?
本文介绍了如何连接在Android的网络打印机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想code Android应用程序,它会连接到一个特定的IP地址的网络打印机,然后进行印刷。
I want to code an Android app, which will connect to a network printer with a specific IP address, and then make a printing.
有关打印我知道我需要写我自己的后记特定的文件类型,并连接到网络还没有结束WIFI的问题。
For printing I know that I need to write my own Postscript for specific files types, and connecting to a network is not a problem over WIFI.
如何连接到网络打印机?
How to connect to the network printer?
推荐答案
连接到网络通过其IP和端口/插座将通信的任何设备。最简单的方法来通过telnet或插座连接和写入数据的套接字缓冲区。
Any device connected to a network will communicate via their IP and Ports / sockets. The simplest way to connect via telnet or socket and write the data to their socket buffers.
try
{
Socket sock = new Socket("192.168.1.222", 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();
}
这篇关于如何连接在Android的网络打印机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文