Go Down

Topic: Connecting to more than 1 url. (Read 865 times) previous topic - next topic


Here is the problem. I have a sketch written with Ver 0021. I can't move it to Ver 1 because it uses several 1-wire libraries that have not been updated. It reads 1-wire weather data and also gets local rss weather feeds from Yahoo. This all works great. What I want to do now is connect to another web site ( PushingBox.com) and send a notification AFTER disconnecting from Yahoo. Does anyone know if this is possible. So far I haven't been able to do it. I don't think the old version of the Ethernet library will allow this.



I don't have v0021, but I do have v0022. Hopefully they are close enough. Declare two instances of Client. Just a rough example code snippet here:
Code: [Select]
byte server[] = { 1,2,3,4 };
byte server2[] = { 2,3,4,5 };

Client client(server, 80);
Client client2(server2, 80);

  // then in your code:
  // connect to first server
  if (client.connect()) {
    Serial.println("connected server1");
    // Make a HTTP request:
    client.println("GET /search?q=arduino HTTP/1.0");
  else {
    // if you didn't get a connection to the server:
    Serial.println("connection server1 failed");

  // connect to second server
  if (client2.connect()) {
    Serial.println("connected server2");
    // Make a HTTP request:
    client2.println("GET /search?q=arduino HTTP/1.0");
  else {
    // if you didn't get a connection to the server2:
    Serial.println("connection server 2 failed");


When you are done with the connection you should call client.stop() and client2.stop();


Thanks guys. It works perfectly!


My Problem: I ask with a sketch about the coordinates Latitude and a second sketch about the road maps and location. Now would be one of these two sketches made ??(2 different server IPs and URLs), can someone help me there? The goal is to display updated every 10 minutes by road and the location on the LCD which depends on the Arduino Mega + Eth + LCD. The sketches are attached. Thank you ...

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131