Mega 2560 with Ethernet Shield W5100

Hello Everyone,

I have an Arduino Mega and a W5100 Ethernet Shield. I am trying to post some data from the Arduino board to the XAMPP server running on my computer. I do not have a router so I have directly connected my Ethernet shield stacked onto the Arduino Mega to the laptop's Ethernet port via an RJ45 cable. I have also assigned the Ethernet connection a static IP address 192.168.0.1 and my localhost page opens when I put this address in my browser.

In my Arduino sketch I have assigned the Arduino shield an IP address 192.168.0.4, i.e. on the same IP segment. When I try to do client.connect to the server (192.168.0.1), i.e. localhost, I get "Connection failed".

ethernet_test21.ino (1.18 KB)

1.JPG

2.JPG

vish2648:
I do not have a router so I have directly connected my Ethernet shield stacked onto the Arduino Mega to the laptop's Ethernet port via an RJ45 cable.

You may need the right cable for this. I think it used to be pink. I think newer laptops can auto-sense the connection.

if needed: How To Make An Ethernet Cross-Over Cable