Python networking-DHCP server Project

Hi all
Im currently working on a project creating a DHCP server
The Server that I’m creating is to give IP addresses to any computer
That requests a new IP address.

My issue is i don’t know how to code the protocol between the client and the Server
I’m attaching below the code for the client and the server

Appreciate the help

Server
import socket
s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)

s.sendto(“dddd”.encode(),(“127.0.0.1”,5000))
d,a=s.recvfrom(1024)
print(d.decode())
s.close()

Client

import socket
s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)

s.sendto(“dddd”.encode(),(“127.0.0.1”,5000))
d,a=s.recvfrom(1024)
print(d.decode())
s.close()

Hey @asafarditi0923109507, welcome to the community.

Please revise your post to format your code as well as to provide potential helpers with more information. Also, please read through these guidelines for posting. Thank you!!

Hi there, welcome to the forums.

Wikipedia has a decent writeup of the handshake involved when a client looks for a DHCP server and subsequently requests an IP address. That should give you an overview of the process.

As to your current code… well, let’s just say you’ve got a lot of work ahead of you. :slight_smile: