Hi,
I've got an arduino uno + ethernet shield setup and running and am trying to connect to it over a direct ethernet connection from my PC, aiming to get UDP or TCP comms running. The server initialises and runs with an IP inside the local subnet for that ethernet connection, and should accept incoming connections to its port. Oddly, however, it instead returns an ICMP port unreachable message.
The basic shape of the setup sequence is based off some of the provided examples:
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip = {169,254,160,92}; // CONFIGURE THIS AS NEEDED
EthernetServer server(8000);
EthernetClient client;
void setup()
{
Serial.begin(9600);
Serial.println("Starting up");
Ethernet.begin(mac, ip);
// Check for Ethernet hardware.
if (Ethernet.hardwareStatus() == EthernetNoHardware)
{
Serial.println("Ethernet shield was not found!");
}
// Check for Ethernet cable connection.
if (Ethernet.linkStatus() == LinkOFF)
{
Serial.println("Ethernet cable is not connected!");
}
server.begin();
Serial.println(Ethernet.localIP());
if (server)
Serial.println("Server Running");
}
void loop()
{
client = server.available();
if (client)
{
Serial.println("Client found");
while (client.connected())
{
if (client.available())
{
// Do stuff, exchange more messages, etc
}
}
}
}
All the appropriate serial messages print to signal success. The wireshark logs show that when trying to communicate to it, the device is identified and responds to the ARP request with the correct MAC address. Thus,
Greatly appreciate if anyone has any ideas why this might be happening and how to fix it.