- Fri Feb 02, 2018 12:02 pm
#198140
I need help, hopefully just a push in the correct direction.
I have written a simple sketch that connect to a telnet server.
The server responds with some information I need to capture and store for use later.
Below is an example of what the server sends me.
I have the code that can read through the message and identifies when the roster lists begins and I read the number into an integer.
What I need is to be able to save the data to however many variables I need. The amount in the roster list will vary.
From the example above i need the following: -
Thanks.
I have written a simple sketch that connect to a telnet server.
The server responds with some information I need to capture and store for use later.
Below is an example of what the server sends me.
Code: Select all
The RL shows that this line is a Roster List, the number after is how many items in this list.RL3]\[Test 1}|{3}|{S]\[Test 2}|{41}|{L]\[Test 3}|{1234}|{L
I have the code that can read through the message and identifies when the roster lists begins and I read the number into an integer.
What I need is to be able to save the data to however many variables I need. The amount in the roster list will vary.
From the example above i need the following: -
Code: Select all
This is what I have so far.Test 1, 3, S
Test2, 41, L
Test 3, 1234, L
Code: Select all
Any help appreciated.void read() {
String content = "";
char character;
while(client.available()) {
character = client.read();
if (character == 'R') {
character = client.read();
if (character == 'L') {
//We are in the roster list section
Serial.println("Roster list seen");
roster = client.parseInt(); //sets how many items in roster
}
}
content.concat(character);
}
}
Thanks.