luke2012 Well-Known Member Licensed User Longtime User May 24, 2017 #1 Hi all, I'm using: Code: AStreams.Write(aPrintBuffer.GetBytes("ISO88591")) To write some data to a target device (in case a printer). Ho to be sure that the target device has got the data that I sent and processed it successfully ? Thanks in advance for your reply.
Hi all, I'm using: Code: AStreams.Write(aPrintBuffer.GetBytes("ISO88591")) To write some data to a target device (in case a printer). Ho to be sure that the target device has got the data that I sent and processed it successfully ? Thanks in advance for your reply.
Erel B4X founder Staff member Licensed User Longtime User May 24, 2017 #2 If AsyncStreams_Error and terminated events were not raised then the data was supposedly sent successfully. How is the printer connected to the Android device? Bluetooth? If it is Bluetooth or TCP (Socket) then you can assume that the data arrived successfully. Upvote 0
If AsyncStreams_Error and terminated events were not raised then the data was supposedly sent successfully. How is the printer connected to the Android device? Bluetooth? If it is Bluetooth or TCP (Socket) then you can assume that the data arrived successfully.
luke2012 Well-Known Member Licensed User Longtime User May 24, 2017 #3 Erel said: If AsyncStreams_Error and terminated events were not raised then the data was supposedly sent successfully. How is the printer connected to the Android device? Bluetooth? If it is Bluetooth or TCP (Socket) then you can assume that the data arrived successfully. Click to expand... First of all... thanks for your reply Erel. The printer is connected via Socket connection. So I have to handle also AsyncStreams_Error and terminated events not only the socket errors. If I understood correctly? Upvote 0
Erel said: If AsyncStreams_Error and terminated events were not raised then the data was supposedly sent successfully. How is the printer connected to the Android device? Bluetooth? If it is Bluetooth or TCP (Socket) then you can assume that the data arrived successfully. Click to expand... First of all... thanks for your reply Erel. The printer is connected via Socket connection. So I have to handle also AsyncStreams_Error and terminated events not only the socket errors. If I understood correctly?
luke2012 Well-Known Member Licensed User Longtime User May 30, 2017 #5 Erel said: That's true. Click to expand... I did a test. This is the code: Code: Sub AStreams_Error Log ("AStream error..." & LastException.Message) End Sub Sub AStreams_Terminated Log ("AStreams Terminated..." & LastException.Message) End Sub I see that the AStreams_Error is raised when a .Connect() fails. I don't understand when AStreams_Terminated is raised ? Upvote 0
Erel said: That's true. Click to expand... I did a test. This is the code: Code: Sub AStreams_Error Log ("AStream error..." & LastException.Message) End Sub Sub AStreams_Terminated Log ("AStreams Terminated..." & LastException.Message) End Sub I see that the AStreams_Error is raised when a .Connect() fails. I don't understand when AStreams_Terminated is raised ?
Erel B4X founder Staff member Licensed User Longtime User May 30, 2017 #6 AStreams_Error cannot be raised when you call connect as AStreams is only initialized after the connection has been established. Generally speaking you should treat the Error and Terminated events in the same way. You can call AStreams_Terminated from AStreams_Error. If the other side gracefully closed the connection then the Terminated event will be raised. Upvote 0
AStreams_Error cannot be raised when you call connect as AStreams is only initialized after the connection has been established. Generally speaking you should treat the Error and Terminated events in the same way. You can call AStreams_Terminated from AStreams_Error. If the other side gracefully closed the connection then the Terminated event will be raised.
luke2012 Well-Known Member Licensed User Longtime User May 30, 2017 #7 Erel said: AStreams_Error cannot be raised when you call connect as AStreams is only initialized after the connection has been established. Generally speaking you should treat the Error and Terminated events in the same way. You can call AStreams_Terminated from AStreams_Error. If the other side gracefully closed the connection then the Terminated event will be raised. Click to expand... No error was raised if the target connected device (ex. printer) is offline / powered off? Upvote 0
Erel said: AStreams_Error cannot be raised when you call connect as AStreams is only initialized after the connection has been established. Generally speaking you should treat the Error and Terminated events in the same way. You can call AStreams_Terminated from AStreams_Error. If the other side gracefully closed the connection then the Terminated event will be raised. Click to expand... No error was raised if the target connected device (ex. printer) is offline / powered off?
Erel B4X founder Staff member Licensed User Longtime User May 31, 2017 #8 The Connected event will be raised with Success = False. It is not related to AsyncStreams. Upvote 0