Ethernet use web server with arduino and ENC28J60

Hi everyone, I recently acquired a ENC28J60 module on ebay (3 €, not having the budget for official shield is 30 €)
I download the required library (http://www.geeetech.com/wiki/index.php/Arduino_ENC28J60_Ethernet_Module)
I tested the program WebServerSimple, having set the IP as: 192.168.0.3
I send it and I test, I have my page that appears.
Now, I have on my laptop at 192.168.0.2 web server (apache2 php5 mysql ...)
with my page in the / test / index.php

I open the WebClient example, I set the ip's, I send, and i have one error :

connecting...
connection failed

disconnecting.

#include <Ethernet.h>

byte mac[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 };
byte ip[] = { 192, 168, 0, 3 };

Server server(80);

void setup() {
  Ethernet.begin(mac, ip);
  server.begin();
}

void loop() {
  Client client = server.available();
  if (client) {
    boolean current_line_is_blank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        if (c == '\n' && current_line_is_blank) {
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
          
          client.print("Analog input 0 = <b>");
          client.print(analogRead(0));
          client.println("</b>
");
          client.print("millis() = <b>");
          client.println(millis());
          client.println("</b>
");
          break;
        }
        if (c == '\n') {
          current_line_is_blank = true;
        } else if (c != '\r') {
          current_line_is_blank = false;
        }
      }
    }
    delay(1);
    client.stop();
  }
}

So I start wiresharks to see what is happening on the network:
when the arduino is web server, everything works fine:
http://www.hostingpics.net/viewer.php?id=125396wiresharkarduinoServer1.png

when the Arduino is a client does not work:
http://www.hostingpics.net/viewer.php?id=955310wiresharkarduinoClient.png

I do not know very well how the packets, and I would like to say to me why its not working in one direction, while in the other it works ...

Thanks everyone.
Timiti29

PS: I use arduino mega 2560

I was using the ENC28J60 with my Uno and it worked fine. Find my description in my blog.

Hi, i have change library to EtherCard, and i was solve the error in my French Topic, the problem was "const" missing, in declaration of variable and function declaration.
Now i haven't error, but i use ENC28J60 with an Arduino Mega, and in Ethernet.h it write the pin connection for a Arduino UNO.
The SPI pin are not the same, I had test with the pin 8 11 12 13 and doesn't work, and i had test with pin 50, 51, 52, 53 and doesn't work again.

I was send the backSoon example, i am arrive to compile this, and i had test to connect with Mozilla Firefox at 192.168.0.3 and i haven't result.

What is the problem ? it's my pin connection ?

Thanks everyone.

Timiti29

reading this

I'd connect:
SCK: pin52
SO: pin50
SI: pin51
CS: pin53