I'm trying to send a mqtt message to Mosquitto, a message that should be received by some smartphones
For sending, I use a Windows PC 1 connected via LAN to the Windows PC 2 where Mosquitto is running
For sending from PC 1, I use a batch file that calls the mosquitto_pub.exe program that comes standard with the Mosquitto installation
The line in the batch file looks like this:
mosquitto_pub -h 192.168.2.200 -p 1889 -t topic_name -u username -p password -m "Message to send ..."
The message starts correctly, the broker accepts it and the phones connected and subscribing to the topic topic_name receive it
But now I'm running into the problem that the Payload normally received from the phones is converted from byte to object with the line
Dim receivedObject As Object = serializator.ConvertBytesToObject(Payload)
while in the case of my sending, the Payload is un-converted and when I go to pass it through the above line it breaks all the information
Then I could either avoid converting while receiving, or convert the string to bytes before transmitting
I want to use the second method because the phones already receive from another sender and therefore
I would like to keep that functionality intact
The question is: how to replicate the
serializator.ConvertObjectToBytes("Message to send....")
functionality on a Windows batch file?
For sending, I use a Windows PC 1 connected via LAN to the Windows PC 2 where Mosquitto is running
For sending from PC 1, I use a batch file that calls the mosquitto_pub.exe program that comes standard with the Mosquitto installation
The line in the batch file looks like this:
mosquitto_pub -h 192.168.2.200 -p 1889 -t topic_name -u username -p password -m "Message to send ..."
The message starts correctly, the broker accepts it and the phones connected and subscribing to the topic topic_name receive it
But now I'm running into the problem that the Payload normally received from the phones is converted from byte to object with the line
Dim receivedObject As Object = serializator.ConvertBytesToObject(Payload)
while in the case of my sending, the Payload is un-converted and when I go to pass it through the above line it breaks all the information
Then I could either avoid converting while receiving, or convert the string to bytes before transmitting
I want to use the second method because the phones already receive from another sender and therefore
I would like to keep that functionality intact
The question is: how to replicate the
serializator.ConvertObjectToBytes("Message to send....")
functionality on a Windows batch file?
Last edited: