Beja Expert Licensed User Longtime User May 9, 2016 #1 Hi, Please someone point me to the correct syntax of initializing the jSerial port without "Prefix" in the b4j/b4a chat example I received the following error: Code: Copy astream.InitializePrefix(sp.GetInputStream, True, sp.GetOutputStream, "astream") Program started. java.lang.RuntimeException: Message size too large. Prefix mode can only work if both sides of the connection follow the 'prefix' protocol. at anywheresoftware.b4a.randomaccessfile.AsyncStreams$AIN.run(AsyncStreams.java:205) at java.lang.Thread.run(Thread.java:745) Error: (RuntimeException) java.lang.RuntimeException: Message size too large. Prefix mode can only work if both sides of the connection follow the 'prefix' protocol. Connection is broken. P.S. I am not using the B4A app on the other side of the chat, but sending string or plain text through the serial port.
Hi, Please someone point me to the correct syntax of initializing the jSerial port without "Prefix" in the b4j/b4a chat example I received the following error: Code: Copy astream.InitializePrefix(sp.GetInputStream, True, sp.GetOutputStream, "astream") Program started. java.lang.RuntimeException: Message size too large. Prefix mode can only work if both sides of the connection follow the 'prefix' protocol. at anywheresoftware.b4a.randomaccessfile.AsyncStreams$AIN.run(AsyncStreams.java:205) at java.lang.Thread.run(Thread.java:745) Error: (RuntimeException) java.lang.RuntimeException: Message size too large. Prefix mode can only work if both sides of the connection follow the 'prefix' protocol. Connection is broken. P.S. I am not using the B4A app on the other side of the chat, but sending string or plain text through the serial port.
besoft Active Member Licensed User Longtime User May 9, 2016 #2 Code: Copy BaudRate =9600 sp.Open("COM5") sp.SetParams(BaudRate,8,1,0) astream.Initialize(sp.GetInputStream,sp.GetOutputStream, "astream") Try this. Upvote 0
Code: Copy BaudRate =9600 sp.Open("COM5") sp.SetParams(BaudRate,8,1,0) astream.Initialize(sp.GetInputStream,sp.GetOutputStream, "astream") Try this.
Beja Expert Licensed User Longtime User May 9, 2016 #3 besoft, thanks.. it's working like a charm! perfect Upvote 0
Beja Expert Licensed User Longtime User May 9, 2016 #4 besoft said: Code: Copy BaudRate =9600 sp.Open("COM5") sp.SetParams(BaudRate,8,1,0) astream.Initialize(sp.GetInputStream,sp.GetOutputStream, "astream") Try this. Click to expand... Hi besoft, In the above example, the data is read only when the NewData event is fired.. but in my project I want to initiate the reading process.. means I want to read the port by a command like : X = MSComm1.input.. I am using a modem and data comes in intervals and stored in the modem buffer, so I want to read it from the buffer. I utterly failed to find a command to read the port.. calling the NewData event didn't work. Any hint or direction? Upvote 0
besoft said: Code: Copy BaudRate =9600 sp.Open("COM5") sp.SetParams(BaudRate,8,1,0) astream.Initialize(sp.GetInputStream,sp.GetOutputStream, "astream") Try this. Click to expand... Hi besoft, In the above example, the data is read only when the NewData event is fired.. but in my project I want to initiate the reading process.. means I want to read the port by a command like : X = MSComm1.input.. I am using a modem and data comes in intervals and stored in the modem buffer, so I want to read it from the buffer. I utterly failed to find a command to read the port.. calling the NewData event didn't work. Any hint or direction?
Erel B4X founder Staff member Licensed User Longtime User May 10, 2016 #5 If you want to initiate the reading yourself then you should read directly from sp.GetInputStream and not use AsyncStreams at all. Upvote 0
If you want to initiate the reading yourself then you should read directly from sp.GetInputStream and not use AsyncStreams at all.