These are chat archives for SmingHub/Sming

Nov 2018
Nov 27 2018 02:39 UTC
Looks good
Connecting to  mqtt://
Let's publish message now. Memory free=49448
Message with id 2 and QoS 1 was delivered successfully.Let's publish message now. Memory free=49392
Message with id 3 and QoS 1 was delivered successfully.Let's publish message now. Memory free=49392
Nov 27 2018 08:25 UTC

I am struggling to send strings to arbitrary telnet session. writeString always returns -1.

@riban-bw Are you using the TelnetServer or you are trying to use the TcpClient as a TelnetClient?

Nov 27 2018 08:27 UTC
@slaff I have created an instance of TelnetServer, disabled commands and try sending strings with writeString. A telnet client connects (sees the Sming message in the telnet client) but there is no further comms.
Nov 27 2018 08:33 UTC
TcpConnection::writeString and TcpConnection::write skip all buffering and write directly to the TCP buffer. So if you are not familiar with LWIP and async operations it will be quite hard to have correct timing. What I mean is that you might send a command with writeString and then nanoseconds later try again to send another command. But the TCP buffer will get filled up and you can write to it only when it frees up some space. Best will be to use TcpConnection::write(IDataSourceStream* stream)
But again you have to know what you are doing. Async programming is a lot of fun :)
Nov 27 2018 09:16 UTC
But why would no messages at all get to the client? I was hoping that the telnet library would give me the ability to send messages to a telnet session. :-(
Nov 27 2018 09:41 UTC
if you filling up the TCP buffer then nothing can be stored in it.
Getting -1 usually means that the buffer is full.
Take a look at our network clients to see how things operate
You usually send something when on the onReadyToSendData is called.
Nov 27 2018 13:35 UTC
I looked at the TelnetSe class and it doesn't seem to override onReadyToSendData so I don't know how it is supposed to work. I can create my own network logging class derived from TcpConnection class but thought TelnetServer should "just work".