Socket read error while connecting the broker through modem

Asked by Venkates Velayutham

Hi,

      While connecting broker through modem it showing "Socket read error on client (null), disconnecting".When the control enter in to the function "mqtt3_net_read" in net.c (if(!context->core.in_packet.have_remaining)) the value of byte before the "read_length = _mosquitto_net_read(&context->core, &byte, 1);" is 26.
After the function call "read_length = _mosquitto_net_read(&context->core, &byte, 1);" the value is changed to 0;It shows the broker was not read the value in the socket.
Please tell me any way to send data to broker.

Regards,
B.Durgadevi

Question information

Language:
English Edit question
Status:
Solved
For:
mosquitto Edit question
Assignee:
No assignee Edit question
Solved by:
Venkates Velayutham
Solved:
Last query:
Last reply:
Revision history for this message
Roger Light (roger.light) said :
#1

> After the function call "read_length = _mosquitto_net_read(&context->core, &byte, 1);"
> the value is changed to 0;It shows the broker was not read the value in the socket.

_mosquitto_net_read() is a wrapper around the network read functions to make it easier to provide cross platform compatibility. On Linux, this means that _mosquitto_net_read() is exactly the same as the read() call. When this function returns 0, it indicates end of file - in a socket context this means that the connection has closed. This is outside the control of the broker.

If this only happens with one type of connection hardware (the term modem covers a wide range of different communications nowadays) then it's likely there is a problem there rather in the broker as such. Mosquitto is quite conservative about what it allows clients to do, so if they misbehave or appear to misbehave then they will be disconnected. I very much doubt that this is the case here because TCP should be ensuring that no packets go astray.

What do you mean by modem? And does it work if the same client and broker are connected directly through a wired lan?

Revision history for this message
Venkates Velayutham (venky) said :
#2

Hi, Roger
Sorry one of my colleague posted this using my computer and hence it appeared as my Id Venkates Velayutham.
I really apologize for posting this question here. Initially we thought you could help give us some hints. We wrote simple server socket program to debug this issue and found the issue is on the client side. Kindly ignore this question.

Regards,

Venky