Created a ChatApp using the concept of Socket Programming (UDP Protocol) & Multi-Threading
Create a UDP python program to Communicate between two systems using the UDP (User Datagram Protocol).
Socket Programming
Not all the program has the capacity to get the data from the network. It is decided by the developer of the module or library.
A Socket is basically the combination of the IP and the port no and Port No. is exactly equal to the program and it is identified uniquely.
Ip : Port no.
Process interacts with the network.

Rules
- Transmision Control Protocol (TCP)
- User Datagram Protocol (UDP)
TCP
It is connection-oriented that always acknowledges or handshake (wait for the connection) the receiver due to this behavior it is slow.
If there is something wrong happens to the packet or receiver end then it resends the packet.
It is reliable and it is used when there is every packet (data) is important.
Example
SMPT, HTTP, FTP, etc.
UDP
It is connectionless and keeps on sending packets without knowing there is a receiver or not due to this behavior it is fast as compared to the TCP.
Non-reliable might lose packet (data) if there is something wrong happens to the packet or receiver end.
Example
Live stream, live videocall, live audio call, etc.
Code
import socket
import threadings = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)my_ip = "192.168.43.101"
my_port = 1234s.bind((my_ip, my_port))def get_data():
while True:
x = s.recvfrom(1024)
print(x[0].decode())def send_data():
while True:
server_ip = "192.168.43.162"
server_port = 1234
msg = input()
msg = "Neeraj : " + msg
s.sendto(msg.encode(), (server_ip, server_port))get_data = threading.Thread(target = get_data)
send_data = threading.Thread(target = send_data)get_data.start()
send_data.start()