- Name server Lookup
- Obtain domain name
- IP address mapping
- DNS records
All the files are jupyter notebooks. Instead of creating python files, you can choose to run the notebooks as they are.
Follow the instrunctions to perform nslookup with python
git clone https://github.com/Adhira-Deogade/Client_Server-communication.git
- Copy the code in nslookup.ipynb
- Create a new python file named "nslookup.py"
nano nslookup.py
- Paste the code and exit the file (Ctrl+O and Ctrl+X)
python nslookup.py "webite name"
(Eg.python nslookup.py gmail.com
)
You will obtain the server that your computer is connected to and the port number. You will also obtain the server to which your server is communicating in order to obtain information from gmail.com (Non-authoritative)
- Run the code in Webbrowser.ipynb
webbrowser.get(chrome_path).open(url, new=2)
where- chrome_path is the path to chrome applciation
- url: url to be opened (here "gmail.com")
- new=2 indicates to open a new tab
1. Creating UDP server
socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
creates a socket with following specifications:AF_NET
defines an IPv4 connectionSOCK_DGRAM
defines datagram for User Datafram Protocol
ServerSocket.recvfrom(2048)
obtains client's address and its messageServerSocket.sendto(modifiedmessage,ClientAddress)
Sends modified data to client address When the server is ready to receive data, start the client
2. Creating UDP client
ClientSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
Create socket for client with same configuration as server (IPv4 and datagram)ClientSocket.sendto(message,(ServerName,ServerPort))
Send data to server addressClientSocket.close()
Close the socket
1. Creating TCP server
serverSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
creates a socket with following specifications:AF_NET
defines an IPv4 connectionSOCK_STREAM
defines streams of data for Transmission Control Protocol
serverSocket.bind(ServerAddress)
Associates server port number with socketserverSocket.listen(1)
Waits for some client to knock on the socket door (defines maximum number of queued connections (atleast 1) 4.connection_socket, addr = serverSocket.accept()
Create a connection socket 3. Receive, update and send the modified message back to client address. Close the connection
2. Creating TCP client
ClientSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
Create socket for client with same configuration as server (IPv4 and streams)clientSocket.recvfrom(2048)
Keep receiveing information from server
Write a python code such that -> Client will continuously provide mathematical problems, while server will keep solving them
- Create a TCP server
- On receving the math problem, solve it with
modified_message = eval(message)
- Create a TCP client
- Send math query to server with
str(raw_input('Enter the lower case message: '))