Posts

Showing posts from April, 2018

Simple Server and Client Chat using Python

Image
In Python language, socket (or network socket) is a module used to communicate between two computers. It provides two types of interface to access the network, namely low-level (platform dependent connections — Example: Telnet) and high-level (application dependent connections — Example: HTTP, FTP, SMTP, etc.). This is a simple tutorial to establish the low-level socket connection between server and client to communicate messages using the TCP/IP protocol. Server and Client Chat In this tutorial, I have used two scripts server.py to serve data by sending an invitation to the client, and client.py to receive data on acceptance of the invitation. After accepting the invitation, both server and client share messages mutually. — Server — An server script performs the sequence of functions such as socket() , bind() , listen() , and accept() (repeats for more than one client) to communicate with the client. The description of each functions used in the server script are given be