0

I'm using this python module in order to print to my escpos printer: https://github.com/Simonefardella/escposprinter

I want to understand how this part of the module it's working:

 def open(self):
    """ Open TCP socket and set it as escpos device """
    self.device = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    self.device.connect((self.host, self.port))

    if self.device is None:
        print ("Could not open socket for %s" % self.host)

Python it's apparently opening only a socket with the socket mode as Stream, and it's ok, everything works like a charm, but i've readed from my printer manual (Standard ESCPOS 80mm Printer) that the buffer of the printer it's only 2048kbytes and if i try to send 10k of data using this module everything it's working despite the buffer indicated in my user manual!

Really, i don't know why, maybe the SOCK_STREAM mode it's sending continously to the printer the data, slicing it in some way...

Can anyone is able to explain me how this is working?

Many thanks

Symon
  • 673
  • 6
  • 25

0 Answers0