wood burning stoves 2.0*
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
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Network Printer" Watch "Network Printer" New topic
Author

Network Printer

Doug Thomas
Greenhorn

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();
printerConnection.setDoOutput(true);

Writer out = new BufferedWriter(new OutputStreamWriter(printerConnection.getOutputStream()));
out.write(printerCommands);
out.close();
} 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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Network Printer