Hi,
I am trying to use MQTT for a project. I am playing arround a little bit. I am using on the Windows side:
https://m2mqtt.wordpress.com/
using vb.net.
I implemented the broker and a client. This works all ok. Now I try to connect the client for android. I use the sample of post https://www.b4x.com/android/forum/threads/b4x-mqtt-chat-room.61568/
Connection goes well. But when I post a message to a subject I get an error in the Andriod app:
add ConvertBytes
In vb dotnet I post the message using:
Does this mean:
1) Is MQTT not compatible, which I do not think so
2) Is the problem converting to bytes? Do I need to convert differently on the dotnet side? Or is the conversion on the android site wrong?
I am kind of lost here.
I am trying to use MQTT for a project. I am playing arround a little bit. I am using on the Windows side:
https://m2mqtt.wordpress.com/
using vb.net.
I implemented the broker and a client. This works all ok. Now I try to connect the client for android. I use the sample of post https://www.b4x.com/android/forum/threads/b4x-mqtt-chat-room.61568/
Connection goes well. But when I post a message to a subject I get an error in the Andriod app:
B4X:
Private Sub client_MessageArrived (Topic As String, Payload() As Byte)
Dim receivedObject As Object = serializator.ConvertBytesToObject(Payload)
add ConvertBytes
B4X:
Connected: true
Error occurred on line: 60 (Starter)
java.io.IOException
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:177)
at libcore.io.Streams.readSingleByte(Streams.java:41)
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:130)
at java.io.DataInputStream.readByte(DataInputStream.java:75)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readByte(B4XSerializator.java:131)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readObject(B4XSerializator.java:299)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.ReadObject(B4XSerializator.java:110)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.ConvertBytesToObject(B4XSerializator.java:81)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:702)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:336)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.BA$2.run(BA.java:328)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5832)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
Caused by: java.util.zip.DataFormatException: incorrect header check
at java.util.zip.Inflater.inflateImpl(Native Method)
at java.util.zip.Inflater.inflate(Inflater.java:237)
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
... 24 more
In vb dotnet I post the message using:
B4X:
pclient.Publish("/all/1", Encoding.UTF8.GetBytes(strValue), Messages.MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE, False)
Does this mean:
1) Is MQTT not compatible, which I do not think so
2) Is the problem converting to bytes? Do I need to convert differently on the dotnet side? Or is the conversion on the android site wrong?
I am kind of lost here.