Ethernet client program question

Hello,
Using ethernet sheld, I want to configure a telnet client to send a query to server and to compare response to a list of predefined value and reply to server. The query is:
client.println("-i.?\r")
The answer is '-i.x ', where x can be from 1 to 12.
The command should be "-i.y", where y is x+1, 12->1.
if (c == "-i.1") {client.println("-i.2")}
if (c == "-i.2") {client.println("-i.3")}
if (c == "-i.3") {client.println("-i.4")}
if (c == "-i.4") {client.println("-i.5")}
if (c == "-i.5") {client.println("-i.6")}
if (c == "-i.6") {client.println("-i.7")}
if (c == "-i.7") {client.println("-i.8")}
if (c == "-i.8") {client.println("-i.9")}
if (c == "-i.9") {client.println("-i.10")}
if (c == "-i.10") {client.println("-i.11")}
if (c == "-i.11") {client.println("-i.12")}
if (c == "-i.12") {client.println("-i.1")}

That is not working because the limitation on client.read().
Because I'm only an electrical engineer and not programmer I seek advice.

Thank you

Hopefully, c is a String..?

And that limitation is . . ?

Please remember to use code tags when posting code

Hello,
client.read () Returns
The next byte (or character), or -1 if none is available.
So is not whole string of characters.

That's not a limitation, that's a pretty standard way of working.

Sorry but I'm stuck in this, whatever it is the way of working.

We're here to help, but we can't just based on what you have told us so far.

(That's a hint: we can't see your code)

There is no code, because I don't know how to output full response ( '-i.X') with client.read () to something to compare with '-i.X' (x being a number between 1 and 12

Start here

String c = client.readStringUntil('\r');

Thank you, but no ending character on response and length is variable.

But every answer begins with ‘-‘

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.