Show Posts
Pages: 1 ... 164 165 [166] 167 168 ... 392
2476  Using Arduino / Networking, Protocols, and Devices / Re: LED will not turn on and off with Ethernet shild on: May 03, 2013, 10:04:28 pm
This should not include the protocol or the server, just the directory/file. It should look like this:
Code:
   client.println("GET /arduino/display.php HTTP/1.0");

edit: Oops! I forgot the "HTTP/1.0". It's there now.
2477  Using Arduino / Networking, Protocols, and Devices / Re: send email to gmail ,sucess telnet and not work in arduino on: May 03, 2013, 11:02:40 am
Then your dns server entries are not set correctly in your network settings for that computer. That is telling you there is no dns server available.
2478  Using Arduino / Networking, Protocols, and Devices / Re: send email to gmail ,sucess telnet and not work in arduino on: May 03, 2013, 08:28:05 am
Then try the gmail email server directly. You should use a local gmail server, so do an nslookup for the ip. From a command prompt
Code:
nslookup
set query=mx
gmail.com
It should list a few email servers. Use the one with the lowest MX preference number. Here is mine:
Quote
C:\Documents and Settings\user>nslookup
Default Server:  ip68-105-28-16.at.at.cox.net
Address:  68.105.28.16

> set query=mx
> gmail.com
Server:  ip68-105-28-16.at.at.cox.net
Address:  68.105.28.16

Non-authoritative answer:
// here is the lowest MX preference
gmail.com       MX preference = 5, mail exchanger = gmail-smtp-in.l.google.com
gmail.com       MX preference = 10, mail exchanger = alt1.gmail-smtp-in.l.google.com
gmail.com       MX preference = 20, mail exchanger = alt2.gmail-smtp-in.l.google.com
gmail.com       MX preference = 30, mail exchanger = alt3.gmail-smtp-in.l.google.com
gmail.com       MX preference = 40, mail exchanger = alt4.gmail-smtp-in.l.google.com

gmail.com       nameserver = ns4.google.com
gmail.com       nameserver = ns1.google.com
gmail.com       nameserver = ns2.google.com
gmail.com       nameserver = ns3.google.com
// Here is the ip for that sever. Use it, but the one your nslookup shows
gmail-smtp-in.l.google.com      internet address = 74.125.134.26
gmail-smtp-in.l.google.com      AAAA IPv6 address = 2607:f8b0:4002:c02::1b
alt1.gmail-smtp-in.l.google.com internet address = 74.125.131.26
alt1.gmail-smtp-in.l.google.com AAAA IPv6 address = 2607:f8b0:400c:c02::1a
alt2.gmail-smtp-in.l.google.com internet address = 173.194.66.26
alt3.gmail-smtp-in.l.google.com internet address = 173.194.65.27
alt3.gmail-smtp-in.l.google.com AAAA IPv6 address = 2a00:1450:4013:c00::1a
alt4.gmail-smtp-in.l.google.com internet address = 173.194.70.26
alt4.gmail-smtp-in.l.google.com AAAA IPv6 address = 2a00:1450:4001:c02::1a
ns1.google.com  internet address = 216.239.32.10
ns2.google.com  internet address = 216.239.34.10
ns3.google.com  internet address = 216.239.36.10
ns4.google.com  internet address = 216.239.38.10
>
C:\Documents and Settings\user>
2479  Using Arduino / Networking, Protocols, and Devices / Re: send email to gmail ,sucess telnet and not work in arduino on: May 03, 2013, 08:17:53 am
i use my local computer as smtp server (192.168.1.2)
What email server program do you have installed in your local computer? Is it Exchange? Sendmail? PostFix?

Is your computer firewall allowing port 25 requests?
2480  Using Arduino / Networking, Protocols, and Devices / Re: send email to gmail ,sucess telnet and not work in arduino on: May 03, 2013, 08:08:15 am
What are you using for the email server ip/domain? Are you using a domain name or an ip?

2481  Using Arduino / Networking, Protocols, and Devices / Re: send email to gmail ,sucess telnet and not work in arduino on: May 03, 2013, 07:52:14 am
I like the screen shots. Post one of the serial monitor after an email send attempt.
2482  Using Arduino / Networking, Protocols, and Devices / Re: send email to gmail ,sucess telnet and not work in arduino on: May 03, 2013, 07:41:20 am
OK, are the network settings for the email code the same as you used for the web server?
2483  Using Arduino / Networking, Protocols, and Devices / Re: send email to gmail ,sucess telnet and not work in arduino on: May 03, 2013, 07:19:08 am
it work in telnet CMD in my pc and server is replay perfectly !
but in arduino didn't work ! how come!
OK, since you are hesitant to post the problem, I'll start with the basics.
Is your ethernet shield connected to a router with a CAT5 cable? It must be connected to the internet to work.
2484  Using Arduino / Networking, Protocols, and Devices / Re: send email to gmail ,sucess telnet and not work in arduino on: May 03, 2013, 04:39:17 am
Quote
still not working
If you are using the email code zoomkat suggested, where does it not work? It will display all the responses from the server.

edit: Here is a link to my latest email code. It has a timeout now.
http://playground.arduino.cc/Code/Email
2485  Using Arduino / Networking, Protocols, and Devices / Re: Problem with two servers on: May 02, 2013, 02:18:25 pm
The code you have in that attached file isn't even close to what I gave you. I never use the String data type.

Maybe you should select a simpler project next time. Two servers on one Arduino is a feat in itself. Most here have trouble with one. Search the forum for two servers on one Arduino. How many do you find?
2486  Using Arduino / Networking, Protocols, and Devices / Re: Problem with two servers on: May 02, 2013, 11:38:24 am
I need more than "it doesn't work". Where does it fail? On startup? When it gets a request? When it opens a file? If you are not sure, put stuff like this at or near code where it is failing.
Code:
Serial.println(F("I'm here #1"));
2487  Using Arduino / Networking, Protocols, and Devices / Re: UDP Broadcast with Ethernet Shield? on: May 02, 2013, 10:33:29 am
Basically, yes. But they must be listening for a broadcast on that port. DHCP servers listen on port 67.
2488  Using Arduino / Networking, Protocols, and Devices / Re: Problem with two servers on: May 02, 2013, 09:44:49 am
it works but when i atach those things with sdfat and sdfatutil library it dosen't work , do you know how to fix this ?
"...it doesn't work." Can you make that any more vague? If you are using an Uno, you may be running out of SRAM.


2489  Using Arduino / Networking, Protocols, and Devices / Re: UDP Broadcast with Ethernet Shield? on: May 02, 2013, 09:08:38 am
I think you still need to use a port and ip, but for broadcast, the ip is 255.255.255.255. You should take a look at the dhcp files for the ethernet shield. It does a broadcast for a dhcp server discovery.
2490  Using Arduino / Networking, Protocols, and Devices / Re: Problem with two servers on: May 02, 2013, 06:23:54 am
Try this to get started. It doesn't use the SD yet, but you can add that later.
Code:
#include <SPI.h>
#include <Ethernet.h>
#include <SD.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// change to your network settings
IPAddress ip( 192,168,2,2 );
IPAddress gateway( 192,168,2,1 );
IPAddress subnet( 255,255,255,0 );

EthernetServer server(80);
EthernetServer server2(8080);

void setup()
{
  Serial.begin(9600);

  // disable w5100 while setting up SD
  pinMode(10,OUTPUT);
  digitalWrite(10,HIGH);

  Serial.print(F("Starting SD.."));
  if(!SD.begin(4)) Serial.println(F("failed"));
  else Serial.println(F("ok"));
  
  Ethernet.begin(mac, ip, gateway, gateway, subnet);
  digitalWrite(10,HIGH);

  delay(2000);
  server.begin();
  server2.begin();
  Serial.println(F("Ready"));
}

void loop()
{
  EthernetClient client = server.available();
  if(client) {
    boolean currentLineIsBlank = true;
    boolean currentLineIsGet = true;
    int tCount = 0;
    char tBuf[64];
    int r,t;
    char *pch;
    IPAddress ipBuf;
    
    Serial.print(F("Client request: "));
    
    while (client.connected()) {
      while(client.available()) {
        char c = client.read();

        if(currentLineIsGet && tCount < 63)
        {
          tBuf[tCount] = c;
          tCount++;
          tBuf[tCount] = 0;          
        }

        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response
          Serial.println(tBuf);
          Serial.print(F("POST data: "));
          while(client.available()) Serial.write(client.read());
          Serial.println();
          
          pch = strtok(tBuf,"?");

          while(pch != NULL)
          {
            if(strncmp(pch,"t=",2) == 0)
            {
              t = atoi(pch+2);
              Serial.print(F("t="));
              Serial.println(t,DEC);            
            }

            if(strncmp(pch,"r=",2) == 0)
            {
              r = atoi(pch+2);
              Serial.print(F("r="));              
              Serial.println(r,DEC);
            }


            pch = strtok(NULL,"& ");
          }
          Serial.println(F("Sending response"));
          client.println(F("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n<html>"));
          client.println(F("<body><H1>TEST</H1>"));
          client.println(F("<form method=GET>T: <input type=text name=t><br>"));
          client.println(F("R: <input type=text name=r><br><input type=submit></form>"));
          client.println(F("</body></html>\r\n"));
          client.stop();
        }
        else if (c == '\n') {
          currentLineIsBlank = true;
          currentLineIsGet = false;
        }
        else if (c != '\r') {
          currentLineIsBlank = false;
        }
      }
    }
    Serial.println(F("done"));
  }

  client = server2.available();
  if(client) {
    Serial.println(F("Server2"));

    boolean currentLineIsBlank = true;
    boolean currentLineIsGet = true;
    int tCount = 0;
    char tBuf[64];
    int r,t;
    char *pch;
    IPAddress ipBuf;
    
    Serial.print(F("Client request: "));
    
    while (client.connected()) {
      while(client.available()) {
        char c = client.read();

        if(currentLineIsGet && tCount < 63)
        {
          tBuf[tCount] = c;
          tCount++;
          tBuf[tCount] = 0;          
        }

        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response
          Serial.println(tBuf);
          Serial.print(F("POST data: "));
          while(client.available()) Serial.write(client.read());
          Serial.println();
          
          Serial.println(F("Sending response"));
          client.println(F("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n<html>"));
          client.println(F("<body><H1>TEST Server 2</H1>"));
          
          client.println(F("</body></html>\r\n"));
          client.stop();
        }
        else if (c == '\n') {
          currentLineIsBlank = true;
          currentLineIsGet = false;
        }
        else if (c != '\r') {
          currentLineIsBlank = false;
        }
      }
    }
    Serial.println(F("done"));
  }
}
Pages: 1 ... 164 165 [166] 167 168 ... 392