PART-1: CLIENT-SERVER CONNECTION USING SOCKET IN PYTHON
Server client connections are the most important topics nowadays. This will use as in the field of P2P communication and sometimes for Hacking (where a Hacker can hide from the client to still client data). Here I’m going to tell you that how to make a connection between client and serve.
In this session, I’m going to use SOCKET and show a demo, where a server can waiting for the client and as the client comes into his network he’ll attack/send messages to the client system.
I’m going to create 2 files one on the server-side and the client-side.
I want to create an IPv4 connection because I want to create a TCP socket and this TCP socket work with the IP address of IPV4.
To establish a connection I’m using socket.AF_INET tells the compiler to select the IPv4 version and socket.SOCK_STREAM and tells the compiler to use the TCP streams and pass these two variables in socket.socket() method that’ll return an object that helps in binding a connection that coming from the clients.
As the client open his portal on the server-side it is always open to making a successful connection with the client after making the successful connection client should be able to get a encode message from the server.
As the server sent the encoded message the client should be able to read it by decoding it.
This is part-1 of the client-server connection. you can get the code on GitHub.
HOW TO RUN: To run this code you first need to run the server.py file so that the server-side person is ready for the incoming connection from the client-side and as the client runs the client.py file the server will make a successful connection and send the encoded messages to the client. Thanks for reading this article.