Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] mosquitto client publish success, but server does not receive data ?

Hi Karl,

Thanks for the quick response.
What you said, was precise and did fix the issue.

I tried loop_start() and then loop_stop() from the callback,
but got a message stating unimplemented ?
ERROR: mosquitto_loop, ret:  10 This feature is not supported.
(maybe no thread ?)

Instead of repeatedly looing, used mosquitto_loop_forever(),
from the publish callback did a mosquitto_disconnect()

Worked like a charm.


Much appreciated !

Thanks Again,

Manu

On Wed, Sep 2, 2020 at 5:17 PM Karl Palsson <karlp@xxxxxxxxxxxx> wrote:
>
>
> You need to keep calling loop(). For qos2 there are multiple back
> and forths. the return code from publish can only say that it has
> been accepted by the library.
>
> You either need to loop_start() and loop_stop(), or call loop()
> repeatedly until your on_publish() callback fires for the MID you
> received from the publish call.
>
> This is a relatively common problem in code that attempts to
> publish once and then exit. They exit well before the message is
> actually published.
>
> Sincerely,
> Karl Palsson
>
>
> Manu Abraham <abraham.manu@xxxxxxxxx> wrote:
> > Greetings,
> >
> > After a bit of a tussle with the client code,
> > mosquitto_publish() apparently states a successful publish.
> >
> > But unfortunately, the server does not receive the data, but
> > states Socket error on client. It is a bit bewildering to me
> > that the data got published, but the server did not receive
> > any.
> >
> > Any idea, what I am incorrectly doing ?
> > (Attached the code, my mail client messes up plain text emails
> > ..)
> >
> > Thanks,
> >
> > Manu
> >
> >
> >
> > On the client side, I see thus:
> >
> > ...
> > Mosquitto lib initialized, ret: 0
> > New Mosquitto Session instantiated
> > Dont verify Server Hostname in Certificate ...
> > 16 Client mosq-Rd9dsJ1bWTrYF7cjnE sending CONNECT
> > Connected to Broker:  192.168.1.34 : 8883
> > 16 Client mosq-Rd9dsJ1bWTrYF7cjnE sending PUBLISH (d0, q2, r0,
> > m1, 'Testing', ... (12 bytes)) Publish success 16:39:20:
> > D:\Work\Test
> > Apps\Qt_Mosquitto\build-QMosquitto-Desktop_Qt_5_15_0_MSVC2019_64bit-Debug\debug\QMosquitto.exe
> > exited with code 0
> >
> > But on the server side all I see:
> >
> > PS C:\Program Files\mosquitto> .\mosquitto.exe -c
> > .\mosquitto.conf -v 1599044951: mosquitto version 1.6.10
> > starting 1599044951: Config loaded from .\mosquitto.conf.
> > 1599044951: Opening ipv6 listen socket on port 8883.
> > 1599044951: Opening ipv4 listen socket on port 8883.
> > 1599044954: New connection from 192.168.1.34 on port 8883.
> > 1599044954: Socket error on client <unknown>, disconnecting.
> > 1599045521: mosquitto version 1.6.10 terminating PS C:\Program
> > Files\mosquitto>
> > _______________________________________________ mosquitto-dev
> > mailing list mosquitto-dev@xxxxxxxxxxx To unsubscribe from this
> > list, visit
> > https://www.eclipse.org/mailman/listinfo/mosquitto-dev_______________________________________________
> mosquitto-dev mailing list
> mosquitto-dev@xxxxxxxxxxx
> To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/mosquitto-dev


Back to the top