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

paulc91316

Member
Licensed User
Longtime 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:

B4X:
Dim ReceiptBuffer() As Byte
ReceiptBuffer = s.GetBytes("UTF8")
receiptPrinterStream.Write(ReceiptBuffer)

Is there an event that says that the buffer is empty?
 
Top