👨💻Task 17👨💻
🔅 Create your own Chat Servers, and establish a network to transfer data using Socket Programing by creating both Server and Clinet machine as Sender and Receiver both. Do this program using UDP data transfer protocol.
🔅 Use multi-threading concept to get and receive data parallelly from both the Server Sides. Observe the challenges that you face to achieve this using UDP.
🧑💻 Solution:-
Step 1: First check The IP of System A
Step 2: Check The IP of system B
Step 3: Write A python Code for Socket programing
#!/usr/bin/env python
import socket
send = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
recv = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
recvIp = "192.168.80.131"
recvPort = 8484
toSendIp = "192.168.80.132"
toSendPort = 8484
recv.bind((recvIp, recvPort))
while True:
send.sendto((input("Enter msg: ").encode()), (toSendIp, toSendPort))
x = recv.recvfrom(1024)
clientip = x[1][0]
msg = x[0].decode()
print(clientip + " :" + msg)
Step 4: Copy the same Code in both systems
Step 5: Change in the code for system A
Step 6: Change in the code for system B
Step 7 :- Run Program in system A and System B
GitHub URL:-
Thank You
Great