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

// Expert user has replied.
V Vedsatx Saddvv 3 years ago
13 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?