M
Michael Mueller
Hello!
I'd like to monitor the status of a lpr-Printer with ruby. I found nice
snippet of Java Code that works fine but I'm running into problems
translating it to ruby.
Obviously my problems have to to with byte-encoding...
The Java-Code is using a socket and sending the data as a byte-Array:
....
Socket socket = new Socket(ip,port);
socket.getOutputStream().write(" List\n".getBytes());
....
Like already said this works just like a charm...
My ruby-Snippet looks like this:
....
socket = TCPSocket::new(server,port)
socker.print(" List\n")
....
socket.flush
respone=socket.gets
...
Unfortunately all I get are some cryptic characters...
Can somebody give me a hint how to do this in ruby?
Michael
I'd like to monitor the status of a lpr-Printer with ruby. I found nice
snippet of Java Code that works fine but I'm running into problems
translating it to ruby.
Obviously my problems have to to with byte-encoding...
The Java-Code is using a socket and sending the data as a byte-Array:
....
Socket socket = new Socket(ip,port);
socket.getOutputStream().write(" List\n".getBytes());
....
Like already said this works just like a charm...
My ruby-Snippet looks like this:
....
socket = TCPSocket::new(server,port)
socker.print(" List\n")
....
socket.flush
respone=socket.gets
...
Unfortunately all I get are some cryptic characters...
Can somebody give me a hint how to do this in ruby?
Michael