title: Print in Android using a printer with specific IP address
body: <p>My query is I have a printer connected to the ethernet and I am able to print to that printer using the IP address of the printer but the issue is the printer stops the moment the lines given for printing ends and hence the paper is stuck in the printer.</p>
  
  <p>My Code:</p>
  
  <pre><code>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();
  }
  </code></pre>