class UDPserver:
def __init__(self):
self.s = socket(AF_INET, SOCK_DGRAM)
def binding(self,port):
# implement here
def talking(self):
while 1:
# implement here
# below is to use the class
udp1 = UDPserver()
udp1.binding(53535)
udp1.talking()
Then the client program is
# using class
from socket import *
class UdpClientClass:
def __init__(self):
self.c = socket(AF_INET, SOCK_DGRAM)
def talking(self,port):
# implement here
# below is to use the class
for ping in range(10):
client = UdpClientClass()
client.talking(53535)
Answer
from socket import *class UDPserver: def __init__(self): self.s = socket(AF_INET, SOCK_DGRAM) def binding(self, port): # binding the port self.s.bind(port) def
OR
OR