check-out-the-class-slides-and-practice-the-udp-server-and-client-socket-coding-as-shown-on-the-video-clip-refer-to-cysecure-org-1

This homework assignment consists of three parts:

[HW6.a] (5pts) Convert the code of udp client and server in object-oriented paradigm. Class should be defined and an object is constructed. For example,

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)

Submission:

1) Python source codes, both client and server

2) Screenshot

[HW6.b] (5 pts) Write tcp socket programs for server and client. The both server and client programs should communicate interactively. One requirement is to display your name in the dialog. A sample run is shown below.

[HW6.c] (2pts) Discuss the difference of UDP and TCP that you implemented above. Your discussion on port numbers of the client(s) will be a perfect answer.

Submission:

1) Python source codes, both client and server

2) Screenshot