python udp client is not much different than tcp clientwe need to make only two small changes to get it to send packets in udp form import socket target_host target_port create socket object client socket socket(socket af_inetsocket sock_dgramsend some data client sendto("aaabbbccc",(target_host,target_port)receive some data dataaddr client recvfrom( print data as you can seewe change the socket type to sock_dgram when creating the socket object the next step is to simply call sendto(passing in the data and the server you want to send the data to because udp is connectionless protocolthere is no call to connect(beforehand the last step is to call recvfrom(to receive udp data back you will also notice that it returns both the data and the details of the remote host and port againwe're not looking to be superior network programmerswe want to be quickeasyand reliable enough to handle our day-to-day hacking tasks let' move on to creating some simple servers