Go Down

Topic: ENC26J60 internet issues. Connection failed (Read 1 time) previous topic - next topic

ThomasH

Using the https://github.com/turicas/Ethernet_ENC28J60/ library which is based alot on the official Ethernet library. Ive been trying to connect the arduino to Quakenet IRC server. Or anything at all really. I can't get it to connect to anything on the internet. If i load it with a ping responder or function as a telnet server it does as intended. but when i try to run the program below it never gets past the if client.connect() statement.

Any suggestions?

Code: [Select]
#include <Server.h>
#include <Ethernet.h>
#include <Client.h>
#include <SPI.h>

byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = {
  10, 82, 15, 70 };
byte server[] = {
  83, 140, 172, 211 };
byte gateway[] = {
  10, 82, 15, 1 };
byte subnet[] = {
  255, 255, 255, 0 };

Client client(server,6667);

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


  Serial.println();
  delay(2000);
  if (client.connect()) {
    Serial.println("Connection established");
  }
  else {
    Serial.println("Connection failed");
  }
}

void loop() {

  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }

  if (!client.connected()) {
    Serial.println();
    Serial.println("Disconnecting from server");
    client.stop();
    while(true){
    }
  }
}



Go Up