Android Question Writing to port 9100 for receipt printers...

Discussion in 'Android Questions' started by paulc91316, Aug 17, 2015.

  1. paulc91316

    paulc91316 Member Licensed User

    I have a question about Sockets and Asyncstreams...

    I'm using sockets to talk directly to port 9100 on a thermal receipt printer. It works great but I can only establish a 1 to 1 relationship. I'd like to have multiple tablets print to the same printer. The printer has multi-session enabled so I can print from multiple tablets (if I close the session). The problem is that I need to disconnect from the first tablet before the second will start printing.

    So my question is how can I tell that my stream has completed to know to disconnect? I'm using this to write to the stream:

    Code:
    Dim ReceiptBuffer() As Byte
    ReceiptBuffer = s.GetBytes(
    "UTF8")
    receiptPrinterStream.Write(ReceiptBuffer)
    Is there an event that says that the buffer is empty?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    There is no "complete" event. I guess that the printer doesn't send any result back, right?

    You can always use a timer and close the connection after a few seconds.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice