This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes Network Printer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Network Printer" Watch "Network Printer" New topic

Network Printer

Doug Thomas

Joined: Dec 06, 2004
Posts: 5
Trying to print to a barcode printer on the network from a WebSphere Server app running on Unix. Following is my print method:

private final void sendToNetworkPrinter(String ipaddress, String port, String printerCommands)
throws JSpaException {

URL printerUrl;
URLConnection printerConnection;

try {
printerConnection = new URL("http://" + ipaddress + ":" + port).openConnection();

Writer out = new BufferedWriter(new OutputStreamWriter(printerConnection.getOutputStream()));
} catch....

When I step through the code, I see on a network monitor that the 'getOutputStream()' results in TCP SYN/ACK messages being exchanged between the server and the printer. But, the short ASCII print command string that the 'write()' method should send does not get sent by the server.

Any ideas?
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Network Printer
Similar Threads
i m new to java pls help for socket program of printer
Printing to a Network Printer
Client Failed to connect, how do I attempt a reconnect?
please help me for ' to print on printer which is in network system
How to print on a Network Printer??