how to get wi-fi printer status(OFF/ON) before printing

// Expert user has replied.
E Efkan YILMAZ 3 years 7 months ago
18 1 0

If printer is off mode every time i am getting Sockets.SocketException so how to check printer status before printing
.
printerIPendPoint = new IPEndPoint(IPAddress.Parse(printerIp), port);
using (socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
{
socket.Connect(printerIPendPoint);
ns = new NetworkStream(socket);
byte[] toSend = Encoding.ASCII.GetBytes(zplLabelString);
ns.Write(toSend, 0, toSend.Length);
}

Please Register or Login to post a reply

1 Replies

S Steven Si

What do you mean by "off mode"? Do you mean the sleep mode? If the printer has sleep mode (not all printers have this feature), then we can wake up the printer by Bluetooth, WiFi, etc. When the print is in sleep mode, it still listens on Bluetooth & WiFi. When the application tries to make a connection via Bluetooth or WiFi, it will wake the printer up. Check out this document for more details - Sleep Mode.
One easiest way to test out is to put the printer in sleep mode with the following commands to enable the sleep mode and set the timeout to 5sec.

! U1 setvar "power.sleep.enable" "on"
! U1 setvar "power.sleep.timeout" "5"
Once the printer is in the sleep mode, try to access the http://192.168.1.65/index.html (replace with your printer's IP address) to wake it up.

CONTACT
Can’t find what you’re looking for?