Arduino to Python Over Ethernet Without Router


I'm attempting to transmit/receive data with an arduino over an ethernet cable plugged directly into my computer. I've gotten to the point where the arduino is definitely receiving data from my computer, but for an unknown reason, never responds. I downloaded wireshark to attempt to diagnose this. At the time the arduino is cycling through the Udp.write area of code, it spams "ARP Announcement for" 10 times or so. No UDP protocol messages originating from the arduino are recorded by wireshark. UDP protocol messages originating from my computer are recorded by wireshark.

I'm using an arduino uno with the ethernet W5100 shield.

I'm afraid my networking experience is essentially zero and have no idea what th ARP announcement means or if it's an issue. But I can't find any other issue.

Arduino Code

#include <Ethernet.h> 
#include <EthernetUdp.h> 

byte mac[] = { 0x34, 0x29, 0x8f, 0x7a, 0x7f, 0x3b}; //Assign a mac address
IPAddress ip(169,254,245,1); //arduino IP
char ReplyBuffer[] = "response";

EthernetServer server(80);
unsigned int localPort = 5000;
char packetBuffer[UDP_TX_PACKET_MAX_SIZE];
String datReq;
int packetSize; 
EthernetUDP Udp;

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

void loop() {
  packetSize = Udp.parsePacket();
  if(packetSize>0){, UDP_TX_PACKET_MAX_SIZE);
  String datReq(packetBuffer); 

    if (datReq =="Blue") { //See if blue was requested
    Serial.println("data requested...");
    Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());  
    Udp.endPacket(); //Packet has been sent
    Serial.println("packet should be sent");
  memset(packetBuffer, 0, UDP_TX_PACKET_MAX_SIZE);

Python Code

from socket import *
import time
address = ( '', 5000) #match arduino IP + port
client_socket = socket(AF_INET, SOCK_DGRAM) 
client_socket.settimeout(5) #wait up to 5 seconds
    data = "Blue" #response should be sent
    client_socket.sendto(data.encode(), address)
        rec_data, addr = client_socket.recvfrom(2048)
        print("No message received")

If the Arduino is set to static IP address then you'd want the PC to be at
Read the section How to assign static IP address using Control Panel in How to set static IP address on Windows 10 - Pureinfotech


Thanks for the assistance!
I tried doing that, i set the computer ip address to, subnet mask to and the gateway to (the last two were just a guess). Wireshark now reporting messages "who has Tell" in a similar fashion: a series of them when the arduino should be writing the udp message.

You should not need a crossover Ethernet cable because modern network cards should now automatically handle this, but if you do have a crossover Ethernet cable, I would try it. Or insert a network switch.

I don't know how you choose 169.254.x.x but that has special meaning. addresses explained -
I would use for the Arduino and for your PC. Private network - Wikipedia


I'm already using a crossover cable. I'm afraid I have no idea how I chose 169.254.x.x, i started and stopped this project awhile ago. Just now picking it up again
I switched the ip addresses as you suggested and it's the same message
What are these subnets/gateways? Do they matter?

Maybe you should try the UDP example program first where the Arduino gets its IP address from the router.
There maybe something else wrong.

Some of the W5100 shields require modification of resistors.

good catch with the resistor issue, mine has 510. When I get parts I'll post again if that resolves the issue or not. Thanks!

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.