Other esc pos printer astream.write error

tango

Member
Licensed User
Longtime User
AStreams.Write("123456789012345678901234567890123456789".GetBytes("UTF-8"))
AStreams.Write(strx.GetBytes("UTF-8"))
AStreams.Write("123456789012345678901234567890123456789".GetBytes("UTF-8"))
AStreams.Write(strx.GetBytes("UTF-8"))

it gives

COM7
java.lang.RuntimeException: Failed to write data. Data length = 39
at anywheresoftware.b4j.serial.Serial$2.write(Serial.java:167)
at anywheresoftware.b4j.serial.Serial$2.write(Serial.java:154)
at anywheresoftware.b4a.randomaccessfile.AsyncStreams$AOUT.run(AsyncStreams.java:334)
at java.lang.Thread.run(Thread.java:745)
java.lang.RuntimeException: java.lang.RuntimeException: Failed to write data. Data length = 39
at anywheresoftware.b4j.serial.Serial$2.write(Serial.java:170)
at anywheresoftware.b4j.serial.Serial$2.write(Serial.java:154)
at anywheresoftware.b4a.randomaccessfile.AsyncStreams$AOUT.run(AsyncStreams.java:334)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: Failed to write data. Data length = 39
at anywheresoftware.b4j.serial.Serial$2.write(Serial.java:167)
... 3 more

what is data lenght problem?
 

tango

Member
Licensed User
Longtime User
hi erel ,
i solved after one day total work.
but i want to learn why? if i use sleep it worked. tell me why?if i reduce sleep time error again. and i dont know if the data is bigger more , i didnt try it.

Dim strx As String
strx=Chr(10)

AStreams.Write("123456789012345678901234567890123456789012345678901234567890".GetBytes("UTF-8"))
Sleep(100)
AStreams.Write(strx.GetBytes("UTF-8"))
Sleep(100)

AStreams.Write("12345678901234567890123456789012345678901234567890123456789".GetBytes("UTF-8"))
Sleep(100)
AStreams.Write(strx.GetBytes("UTF-8"))
Sleep(100)

AStreams.Write("123456789012345678901234567890123456789".GetBytes("UTF-8"))
Sleep(100)
AStreams.Write(strx.GetBytes("UTF-8"))
Sleep(100)
 
Upvote 0
Top