O Omar Moreno Member Licensed User Longtime User Jun 14, 2018 #1 Hello everyone. Thank you for the help that you may be able to provide. I have created a module with JShell to execute another program type Server and to be able to catch the LOG. The problem I have is that the Buffer() parameter is not cleaned every time it catches new LOGs. Code: Sub sh1_StdOut (Buffer() As Byte, Length As Int) ... 'how to clean the buffer() End Sub In each event that a LOG catches, when I print the data it leaves with the data of the previous LOG. I have placed two examples programs the ShellLog.jar is responsible for calling the JarX.jar. In the JarX.jar press the test buttons and you will see that in the window of the ShellLog.jar the LOGs come out but mixed with the data of the previous LOG. How can this be resolved. Thank you. Attachments ShellLogs.zip ShellLogs.zip 2.7 KB · Views: 358 JarX.zip JarX.zip 2.4 KB · Views: 339
Hello everyone. Thank you for the help that you may be able to provide. I have created a module with JShell to execute another program type Server and to be able to catch the LOG. The problem I have is that the Buffer() parameter is not cleaned every time it catches new LOGs. Code: Sub sh1_StdOut (Buffer() As Byte, Length As Int) ... 'how to clean the buffer() End Sub In each event that a LOG catches, when I print the data it leaves with the data of the previous LOG. I have placed two examples programs the ShellLog.jar is responsible for calling the JarX.jar. In the JarX.jar press the test buttons and you will see that in the window of the ShellLog.jar the LOGs come out but mixed with the data of the previous LOG. How can this be resolved. Thank you.
Erel B4X founder Staff member Licensed User Longtime User Jun 14, 2018 #2 There are several mistakes in your code. Start with this: Code: Sub sh1_StdOut (Buffer() As Byte, Length As Int) Log(BytesToString(Buffer, 0, Length, "utf8")) End Sub The output here is: *** SERVIDOR INICIADO EL: 14/06/2018 08:59:44 CONECTADO A LA BASE DE DATOS: OK *** P1 SE HA EJECUTADO OK P2 SE HA EJECUTADO EN 20 SEGUNDOS P3 NO SE HA EJECUTADO, VERIFIQUE P4 SE HA EJECUTADO OK Looks correct. Upvote 0
There are several mistakes in your code. Start with this: Code: Sub sh1_StdOut (Buffer() As Byte, Length As Int) Log(BytesToString(Buffer, 0, Length, "utf8")) End Sub The output here is: *** SERVIDOR INICIADO EL: 14/06/2018 08:59:44 CONECTADO A LA BASE DE DATOS: OK *** P1 SE HA EJECUTADO OK P2 SE HA EJECUTADO EN 20 SEGUNDOS P3 NO SE HA EJECUTADO, VERIFIQUE P4 SE HA EJECUTADO OK Looks correct.
O Omar Moreno Member Licensed User Longtime User Jun 14, 2018 #3 Thank you for the correction. It worked very well with the real server. Another question: the parameter for the encoding "utf8" or "UTF-8" does not show the tildes Upvote 0
Thank you for the correction. It worked very well with the real server. Another question: the parameter for the encoding "utf8" or "UTF-8" does not show the tildes
Erel B4X founder Staff member Licensed User Longtime User Jun 14, 2018 #4 Please start a new thread for a new question and make it more clear. I don't understand it. Upvote 0