Name: Aman Lohani SE-A Roll no:18
Python Programming
Experiment – 7
Aim: Write a program to create a two-way communication
between Server and Client in python (using TCP/IP)
Theory:
Socket: A socket is the end-point in a flow of communication between
two program . They are created by socket API
The socket module of Python offers an interface to the Berkeley sockets
API. Below are the primary functions and methods of Python socket
module.
o socket() - It is used to create the socket object.
o bind() - It is used to bind-address to the socket. It takes two
arguments hostname and port number.
o listen() - It is used to establish and start the TCP listener.
o accept() - It is used to TCP client connection until the connection
is established.
o connect() - It is used to initiate TCP server connection.
o sendto() - It is used to send the UDP messages.
o send() - It is used to send the TCP messages.
o recv() - It is used to receive the TCP messages.
o close() - It is used to close a socket.
Conclusion:
By this we learned about TCP/IP in python.