Python

How to send a UDP packet in Python

Tags: 

Recently, I ran across a problem where I wanted to automate the testing of a microcontroller for which I was unable to modify the locked down embedded software. Moreover, the microcontroller could only communicate over an Ethernet network using TCP/IP and UDP. Sending either a TCP or UDP packet onto a network is a very easy thing to do using Python, but takes a little bit of knowledge about networking for it to make sense. In this tutorial I am going to give the most bare-bones and simplest possible way to send a packet of data over a network using UDP.

  1. Sending a UDP Packet
  2. Handling Basic Exceptions