TCP Socket Programming in Python (server/client)
Socket Programming in Python What is Socket : A socket is one end of a two-way communication link between two programs/software running on the network. A socket is bound to a port (also known as process id) number so that the TCP/UDP layer can identify the application that data to be transferred to. What to do? in order to create a server first, we need to create a socket in the program and put this socket into the listen mode. to that in the python is very easy, as you all know python is a very easy and powerful language. Socket Creation Create a New python file named as the server.py keep in mind that to work with socket we need to import socket into the file. import socket TCP_IP = '127.0.0.1' TCP_PORT = 15710 s = socket.socket(socket.AF_INET,socket.SOCK_STREAM) s.bind((TCP_IP,TCP_PORT)) TCP_IP is the IP of this machine you are working on, and TCP_PORT is the port to be connected. socket.AF_INET is the protocol to work with the TCP protocol. Listening to connection and a