socket.accept()is used to accept the connection from the client. This method returns two values,client_socketandclient_address, whereclient_socketis a new socket object that's used to send and receive data over the connection.
socket.sendto(data, address) is used to send data to a given address.
The bind(IP,PORT) method allows you to associate a host and a port with a specific socket, for example, server.bind(("localhost", 9999)).
The main difference between TCP and UDP is that UDP is not connection-oriented. This means that there is no guarantee that our packets will reach their destinations, and there is no error notification if a delivery fails.
socket.connect_ex(address) is used for implementing port scanning with sockets.