I was working on implementing ESC/POS(Epson Standard Code for Point of Sale) on a Kitchen printer(Aclas KP71M).
I have a user interface the the POS user enters its str
Answering this question in case anyone else comes along with the same q. This is what worked for me:
Socket clientSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
clientSock.NoDelay = true;
IPAddress ip = IPAddress.Parse("192.168.0.18");
IPEndPoint remoteEP = new IPEndPoint(ip, 9100);
clientSock.Connect(remoteEP);
Encoding enc = Encoding.ASCII;
// Line feed hexadecimal values
byte[] bEsc = new byte[4];
bEsc[0] = 0x0A;
bEsc[1] = 0x0A;
bEsc[2] = 0x0A;
bEsc[3] = 0x0A;
// Send the bytes over
clientSock.Send(bEsc);
// Sends an ESC/POS command to the printer to cut the paper
string output = Convert.ToChar(29) + "V" + Convert.ToChar(65) + Convert.ToChar(0);
char[] array = output.ToCharArray();
byte[] byData = enc.GetBytes(array);
clientSock.Send(byData);
clientSock.Close();