Socket programming is a way of connecting two nodes on a network to communicate with each other. One socket(node) listens on a particular port at an IP, while the other socket reaches out to the other to form a connection. The server forms the listener socket while the client reaches out to the server.
Socket Programming Digram :
1:- Server
# first of all import the socket libraryimportsocket# next create a socket objectsocket_obj=socket.socket()# Next bind to the portsocket_obj.bind(('localhost',8002))# put the socket into listening modesocket_obj.listen(4)# Establish connection with client.client_obj,address=socket_obj.accept()# receive data from clientrecv_msg=client_obj.recv(1024)# Decode datarecv_msg.decode('utf-8')# Print Dataprint(recv_msg)# Close the connection with the clientsocket_obj.close()
1:- Client
# import the socket libraryimportsocket# Create a socket objectsocket_obj=socket.socket()# connect to the server using host and portsocket_obj.connect(('localhost',8002))# input datamsg=str(input("Entter your message : "))# encode and send the data from input datasocket_obj.send(msg.encode('utf-8'))
Here is the final result :
Owner
Janak raikhola
Actions do not cling to me because I am not attached to their results. Those who understand this and practise it live in freedom.
BaseSpec is a system that performs a comparative analysis of baseband implementation and the specifications of cellular networks. The key intuition of BaseSpec is that a message decoder in baseband s
A python 3 library which helps in using nmap port scanner. This is done by converting each nmap command into a callable python3 method or function. System administrators can now automatic nmap scans
Finding and storing a list of proxies can be taxing - especially ones that are free and may not work only minutes from now. proxlist will validate the proxy and return a rotating random proxy to you
Nautobot is a Network Source of Truth and Network Automation Platform. Nautobot was initially developed as a fork of NetBox (v2.10.4). Nautobot runs as a web application atop the Django Python framew