The Guide of Implementing Chat Protocol: Study Case On Using The Socket Programming Concept and Object Oriented Programming
The Guide of Implementing Chat Protocol: Study Case On Using The Socket Programming Concept and Object Oriented Programming
HTTPS://SITES.GOOGLE.COM/SITE/JOURNALOFCOMPUTING/
WWW.JOURNALOFCOMPUTING.ORG 18
Abstract: In the past, communication among people was limited and very difficult. Nowadays, the Internet makes our life very
easy. Through the Internet you can easily communicate with people in different corners of the world in a few seconds. These days,
the world has been converted into a small village by the Internet. The chat room is one of the effective communication tools. In this
paper, a new protocol is presented for the chat room using the socket programming concept. This protocol has been implemented
using Java.
Index Terms— Transmission Control Protocol, User Datagram Protocol, FTP and Chat Protocol.
—————————— ——————————
operates at a higher level, concerned only with the
two end systems, for example, a Web browser and a
Web server. In particular, the TCP provides reliable,
1. INTRODUCTION ordered delivery of a stream of bytes from one
The term of chat room, or chatroom, is primarily program on one computer to another program on
used by the mass media to describe any form of another computer. Besides the Web, other common
synchronous conferencing, occasionally even applications of the TCP include e-mail and file
asynchronous conferencing [1]. The term can thus transfer. Among its management tasks, the TCP
mean any technology ranging from real-time online controls message size, the rate at which messages
chat over instant messaging and online forums to are exchanged, and network traffic congestion. The
fully immersive graphical social environments [2]. TCP provides a communication service at an
In computing, network programming, essentially intermediate level between an application program
identical to socket programming or client-server and the Internet Protocol (IP). In other words, when
programming, involves writing computer programs an application program desires to send a large
that communicate with other programs across a chunk of data across the Internet using IP, instead
computer network. The program or process of breaking the data into IP-sized pieces and issuing
initiating the communication is called a client a series of IP requests, the software can issue a
process, and the program waiting for the single request to the TCP and let the TCP handle the
communication to be initiated is the server process. IP details [6] as shown as in fig 1.
The client and server processes together form a
distributed system. The communication between
the client and server processes may either be
connection-oriented (such as an established TCP
virtual circuit or session) [3], or connectionless
(based on UDP datagrams). A program that can act
both as a client and a server is based on peer-to-
peer communication [4].
JOURNAL OF COMPUTING, VOLUME 2, ISSUE 10, OCTOBER 2010, ISSN 2151-9617
HTTPS://SITES.GOOGLE.COM/SITE/JOURNALOFCOMPUTING/
WWW.JOURNALOFCOMPUTING.ORG 19
A datagram socket is a type of Internet socket, message will reach the receiving application
which is the sending or receiving point for packet first. When data packets arrive in the wrong
delivery services. Each packet sent or received on a order, the TCP layer holds the later data until
datagram socket is individually addressed and the earlier data can be rearranged and
routed. Multiple packets sent from one machine to delivered to the application.
another may arrive in any order and might not
arrive at the receiving computer. The User 4. Heavyweight – the TCP requires three packets
Datagram Protocol (UDP) is one of the core just to set up a socket, before any actual data
members of the Internet Protocol Suite. The UDP can be sent. It handles connections, reliability
sends always enabled on a datagram socket. In and congestion control. It is a large transport
order to receive broadcast packets a datagram protocol designed on top of IP.
socket should be bound to the wildcard address.
Broadcasted packets may also be received when a 5. Streaming - Data is read as a "stream," with
datagram socket is bound to a more specific address nothing distinguishing where one packet ends
[7] as shown in fig 2. and another begins. Packets may be split or
merged into bigger or smaller data streams
arbitrarily.
JOURNAL OF COMPUTING, VOLUME 2, ISSUE 10, OCTOBER 2010, ISSN 2151-9617
HTTPS://SITES.GOOGLE.COM/SITE/JOURNALOFCOMPUTING/
WWW.JOURNALOFCOMPUTING.ORG 20
3. Part three is the message itself. Server will read the message and start its check,
check 1st the type of message if its one or two or
4. Classification of message (private or public) three to know weather its normal chat message or
request message or FTP message
5. Type of message (should be one).
JOURNAL OF COMPUTING, VOLUME 2, ISSUE 10, OCTOBER 2010, ISSN 2151-9617
HTTPS://SITES.GOOGLE.COM/SITE/JOURNALOFCOMPUTING/
WWW.JOURNALOFCOMPUTING.ORG 21
Fig9. This fig showing the request was sent from the
server to the wanted client
Fig 7. If the request message is typed, then the
Fig 10 shows the case of the first. Client wanting to
request will be like this. initiate talk. He will write the message and then he
will start sending it through the server. In this case,
the message will have number one in the last field
which means that it is a chat message. The server
checks the 1st field, and if it confirms that it is one
then it will check the 2nd field. If it is one, then it is
public and there is no need to check again. In this
case, the client just broadcasts the message to the
other client. However, if the number in the 2nd field
is 2, then the server checks the 5th field and checks
its number which indicates the client number. Then,
the server sends this message to this client. When
the client reserves the message, it reads the 4th field
and checks from where the message originates and
puts it in his or her window.
JOURNAL OF COMPUTING, VOLUME 2, ISSUE 10, OCTOBER 2010, ISSN 2151-9617
HTTPS://SITES.GOOGLE.COM/SITE/JOURNALOFCOMPUTING/
WWW.JOURNALOFCOMPUTING.ORG 22
5. System Interfaces
JOURNAL OF COMPUTING, VOLUME 2, ISSUE 10, OCTOBER 2010, ISSN 2151-9617
HTTPS://SITES.GOOGLE.COM/SITE/JOURNALOFCOMPUTING/
WWW.JOURNALOFCOMPUTING.ORG 23
Fig13. Showing the undefined person tries to login and how the system rejects it
JOURNAL OF COMPUTING, VOLUME 2, ISSUE 10, OCTOBER 2010, ISSN 2151-9617
HTTPS://SITES.GOOGLE.COM/SITE/JOURNALOFCOMPUTING/
WWW.JOURNALOFCOMPUTING.ORG 24
JOURNAL OF COMPUTING, VOLUME 2, ISSUE 10, OCTOBER 2010, ISSN 2151-9617
HTTPS://SITES.GOOGLE.COM/SITE/JOURNALOFCOMPUTING/
WWW.JOURNALOFCOMPUTING.ORG 25
JOURNAL OF COMPUTING, VOLUME 2, ISSUE 10, OCTOBER 2010, ISSN 2151-9617
HTTPS://SITES.GOOGLE.COM/SITE/JOURNALOFCOMPUTING/
WWW.JOURNALOFCOMPUTING.ORG 26
ACKNOWLEDGEMENT
This research was partially supported by the King REFERENCES
Saud University, Riyadh, Saudi Arabia, the
University of Malaya, Kuala Lumpur, Malaysia and [1] Greenberg, S. and Roseman, M., “Using a room
metaphor to ease transitions in groupware”, Sharing
“Al-Madinah International University”, Shah Alam, Expertise: Beyond Knowledge Management, 2003, P:
Malaysia. First and foremost I would like to thank 203-256.
“ALLAH” (SWT), most gracious and most merciful. [2] Zissis, D. and Lekkas, D. and Papadopoulou, A.E.,
I would like to thank Dr. Rafidah Md Noor for her “Competent electronic participation channels in
electronic democracy”, Electronic Journal of
continue support, encouragement and valuable egovernent, 2009, Vol 7(2), P: 195-208.
discussions during my research work. I also would [3] Kalajan, K.E. and Mueller, T.R. “Connection-oriented
like to express the deepest appreciation to Professor session emulation”, Google Patents, 1999.
Abdullah Ben Abdul-Rahman Abdullah Al- [4] Ford, B. and Srisuresh, P. and Kegel, D., “Peer-to-peer
Othman, Dr. Ali ibn Sulaiman Al-Attiyah and Prof. communication across network address translators”,
USENIX Annual Technical Conference, 2005.
Dr. Mohammad Khalifa Al-Tamimi. My thanks are
[5] Bellovin, SM, “Security problems in the TCP/IP
also extended to Dr. Ali bin Abdullah Alafnan, Dr. protocol suite”, ACM SIGCOMM Computer
Abdullah Alsbail, Dr. Muhammed Al Arifi, Dr. Communication Review, 1989, Vol 19 (2), P: 32-48.
Musaed AL-Jrrah, and Mr. Abdullah Alsbait. [6] Stevens, W.R. and Wright, G.R., “TCP/IP Illustrated:
Dr.Khalid Alhazmi, Mr. Seraj, Mr. Khalid and all the protocols”, Addison-Wesley, 1994.
the staff in the King Saud University especially in [7] Postel, R.J.,” User datagram protocol”, Citeseer, 1980.
Applied Medical Science for their unlimited
support. Without their notes and suggestions this