How to communicate with printer from ruby language?

I want to communicate with printer by using ruby language. i am using
socket programming to communicate with printer. my printer ip is
“” and port number is “20000”.

Below is the code that i am using to communicate with printer

require ‘socket’
sock =‘’, 20000)
sock.write ‘MARK START’

In the above code i am sending “MARK START” command to the printer which
will turn printer ON , but it’s not working. with above code i am able
to established connection with remote server but not able to send “MARK
START” command.

But the same is working with putty. with putty i am using connection
type as “raw” and connecting to the printer.After connection is
successful i can send command “MARK START” to putty and able to turn on

I want to know why my code is not able to send “MARK START” command to

Thanks, Sanjay Salunkhe

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs