Today, in this world of social media there are many applications that enable us to share data between people who are distances apart. These social media applications run a variety of platforms. Our project is about a social media application through which we can chat and share files with other people living in different parts of the world which runs on a Desktop. Python programming language and its modules were used in this project. A client-server model and TCP protocol for communication are used in our project. It has a simple GUI interface implemented.
Introduction
I. INTRODUCTION
Communication is a means for exchanging one’s ideas, feelings, data and information with others, since the dawn of humanity. Earlier, humans used to produce different sounds which meant different things. With the development of languages, humans began to use writing and speech to convey their messages and thoughts. Pigeons and horse riders became the primary means for long distance communications. When the industrial revolution began in the 1830s, the telegraph and later the telephone became the popular sources of communication. The atomic age led to the development of computers. In information era, Internet was introduced. Now the data could be shared between the computers anywhere in the world by connecting to the internet. Various computer technologies made communication and data transfer better and better. Python programming language is used in our project. Socket module for opening sockets for communication, Tkinter module for GUI and Threading module for multithreading are some of the modules used. Our project has two python source codes. One for a server and other for clients. The server program would run on a host machine and the client program on client machines which upon running would connect to the server and would be ready for data transfer.
II. LITERATURE SURVEY
In paper [1] Randell mentions the history of the internet. All the political, technical and social developments that led to the development of internet are discussed in his The Soul of Internet. In his text, he mentions his thoughts about the social media applications that would run on the internet. It covers the interviews of the great personalities that were behind the internet technology.
In paper [2] the process of multithreading and its benefits are mentioned in Intel Hyper Threading Technology. The authors have explained the process multithreading and hyperthreading, its advantages and disadvantages and compared the results of CPU performances with one thread and multiple threads running on a single CPU core. Multithreading is used in our project for performing the sender and receiver tasks concurrently.
In paper [3] Michael Hauben, an internet theorist and author in his text described the social impact of internet. He developed the term and concept of ‘Netizen’ which means a citizen of the net or an internet user who actively contributes to the development of the net. He mentions the increase of popularity and usage of chat applications due to users being free and fearless to communicate with others.
In his book [4] Richard Stevens provides a guide on Unix Network Programming using sockets and Network APIs. A socket object represents a low-level access point to an IP Stack. A socket can send and receive data which forms the basis of our project for data exchange. A socket can be open or closed. This book is a must read to understand the network programming in order to build web server apps, client-server apps or any other network apps.
In paper [5] Vincent Cerf and Robert Kahn provided a guide on the TCP protocol. This protocol is used by World Wide Web, File Transfer Protocol, peer to peer file sharing and streaming media. SSL/TLS runs on top of this protocol. TCP provides a reliable, error checked and ordered transfer of bytes of data. This makes it an important part in the working of our application.
III. IMPLEMENTATION
Our project works on a client-server model. The machine that runs the server code becomes the host machine. The client program is the end user program that on running gets connected to the server. Both the programs use TCP sockets to connect and communicate with each other. In the server program, a socket object is created and the home IP address 127.0.0.1 along with a port number is bound to it.
The server listens for incoming connections and accepts the connection and IP address of the connecting client. When a client connects to the server, the server stores the client’s connection object in a list of client connections. The message that a new client has joined the chat is broadcasted over the network of devices connected to the server. The server uses multithreading for its functionality. For each client, a new thread is created for that client on the server. This thread is used to receive messages from the connected clients whereas the main thread listens for new incoming client connections. The server thus relays the messages received from a client to other clients in the network. The data received from the clients can be in string format or a file format. When a client exits, the server stops the exited client’s thread, closes the connection and removes its connection object from the client connections list. In the client program, a socket object is created similarly as that of a server to communicate with the server. Next, the s.connect() method is used to establish a connection to the server. This method takes two parameters, the IP address of the server and the port which is open for this service. A TCP three-way handshake takes place between the server and client before the connection is established. After the connection is established, the client sends the name that is entered by the user to the server, the server broadcasts the message that a new client has joined the chat with the name of the client.
In the client program, tkinter module was used for GUI development. A simple user interface was implemented to enable users to see messages and files sent over the network. Similar to the server, multithreading was implemented in the client with the help of threading module. The main thread is utilized by the program to send messages whereas the second thread is created and utilized for the purpose of receiving messages. The file data and string messages can be sent or received in this program. The client's name is added to the data that the client sends, so as for the receiving clients to recognize from which client the messages are incoming. To send a string message, an entry field is provided where the user can type his message and then click on the send button to send it to other clients through the server. File can be sent by clicking on the two dots button and selecting the required file. The program then opens this file in read mode. The data is stored in a buffer whose size can be specified according to the requirements. After this buffer is full, the data is sent and this process repeats till all of the file is sent. The client then closes the file. On the receiving end, the client tries to decode the data received. If the decryption succeeds, the data is string data. String data is displayed on the screen. If the decryption fails, the data is file data. Appropriate variables are set to write this data to a file. Buffer by buffer the data is written to the file till all the file is received. The file is then closed. A folder keeps the track of all the files that are received. When the client exits, it sends that it has left the chat message over the network before closing the connection with the server.
Conclusion
From our research we can conclude that, the invention of computers and internet has led to a technological boom in the world. Internet is being used as a backbone for social media applications to interact with humans living distances apart from each other. We have learned a lot from the development of this project. We got to know more closely, how networking works and how data transfer takes place. The literature review has given us a lot of information which formed the basis of our chat application. The development in technology and increasing use of social media apps, the world is getting closer. Social media is influencing the lives of people politically, socially, technologically more than ever. The importance of sharing data with other people was understood by us and it led to the development of this project. The objective of our project that is being able to chat and share files has been successfully fulfilled. The project was successfully implemented.
References
[1] Neil Randell “The Soul of the Internet”, 1997
[2] Cody Tinker, Christopher Valerino “Intel Hyper Threading Technology”
[3] Michael Hauben “The Net and the Netizens”, 1997
[4] Richard Steven “Unix Network Programming”, 1990
[5] Vincent Cerf and Robert Kahn “A Protocol for Packet Network Intercommunication”, 1974