Hello, I’m just wondering if anyone’s had any luck sending data to a receipt printer via a TCPSocket?
I’m woking in IOS but I guess the same question would stand in a desktop app.
I’ve opened a connection with a Epson Receipt printer (TM-M30ii) from simulator to printer
across wifi, this looks OK but now I’m trying to send ESC/POS commands to it via the
TCPSocket.Write method like so…
TCPSocket1.Address = “192.168.20.166”
TCPSocket1.Port = 443
// connect the socket
TCPSocket1.Connect
// while the socket isn’t connected
While Not TCPSocket1.IsConnected
// poll the socket to let it do its thing
TCPSocket1.Poll
// if an error occurs, the Error event will fire
Wend
// if we broke the loop because we’re connected
If TCPSocket1.IsConnected Then
Dim S as string
S = “Hello world”
TCPSocket1.Write(s)
TCPSocket1.Flush
//TCPSocket1.Write(“ESC “”@”" ““Hello world”” LF")
End If
// close the socket
TCPSocket1.Close
I’m stepping through the code and it does the .write bit OK but the printer
is not responding in any way. My first guess is that I’m not sending the correct codes
in the correct way, but after much Googling I’m no closer to a result.
Many thanks.
Barney