Reading data from Jdownloader Remote

I want to use my arduino with ethernet shield to read data from the jdownloader remote (basically a web interface for jdownloader to show download speed etc) and output to an lcd

basically with my setup the "remote" interface runs on port 10025 and to read the speed you connect to computersip:10025/get/speed and it displays the value nothing else.

after the arduino has connected to the server i cant figure out how to tell it to connect to the /get/speed bit and tell it which port to use.

would i need to use print() or println() or write()

cheers

bump

I haven’t use jdownloader or remote. However, the ethernet functions should work using write or print.

From what you indicate with computersip:10025/get/speed, it probably uses the http protocol? …and if so, compile and load the following sketch on the arduino (based off of the client ethernet example sketch) which should connect and get the value.

However, since I don’t know the response format - you will have to decode what you see in the debug window and get the value. The code I have included will skip the HTTP header and show everything else.

#include <Ethernet.h>

byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip = { 10, 0, 0, 177 }; // set this to your network’s-like IP (make it unique though)
byte server = { 64, 233, 187, 99 }; // Set this to your server IP

Client client(server, 10025);

void setup()
{
Ethernet.begin(mac, ip);
Serial.begin(9600);

delay(1000);

Serial.println(“connecting…”);

if (client.connect()) {
Serial.println(“connected”);
client.println(“GET /speed HTTP/1.0”);
client.println();
readPastHeader(&client);
} else {
Serial.println(“connection failed”);
}
}

void loop()
{
if (client.available()) {
// HERE IS WHERE YOU TWEAK THE OUTPUT TO LCD
char c = client.read();
Serial.print(c);
}

if (!client.connected()) {
Serial.println();
Serial.println(“disconnecting.”);
client.stop();
for(;:wink:
;
}
}

bool readPastHeader(Client *pClient)
{
bool bIsBlank = true;
while(true)
{
if (pClient->available())
{
char c = pClient->read();
if(c==’\r’ && bIsBlank)
{
// throw away the /n
c = pClient->read();
return true;
}
if(c==’\n’)
bIsBlank = true;
else if(c!=’\r’)
bIsBlank = false;
}
}
}