UDP Based Chat Application
UDP Based Chat Application
Abstract—UDP is a connectionless oriented transport layer TCP is connection Oriented protocol while UDP is
protocol. Since TCP doesn't provide the feature of connectionless protocol [6]. UDP protocol is a simple
Multicasting UDP is a widely used protocol to implement it. connectionless protocol that can be used to transfer datagram
UDP's stateless nature is useful for servers that answer small packets between sender and receiver in both the direction i.e.
queries for large number of clients. Socket network
programming is one of the most popular technologies used to
client and server can send and receive datagram packets to
build a chat application and establishing network each other. User Datagram Protocol transports the data
communication between systems. Socket programming helps to between the computers in the form of data packets, but it
implement the bottom level of network communication, using does not track the data and never shows the confirmation
Application Programming Interface (API). In this paper we report as shown in Fig 1. Many of the streaming applications
propose a method to make a chat room using socket based on run using UDP, but they have built-in acknowledgments and
User Datagram Protocol (UDP) which enables the feature of retransmissions into the application in order reduce packet
acknowledgments after every message sent. It is equivalent to loss. And file sharing through UDP also alleviates the
a dedicated chat server having a Server and n number of problems occurring in TCP. UDP [7] has a very basic and
Clients. After client and server set up to connect, you can
achieve many machines to communicate through peer to peer
simplified header which has only 8 bytes of overhead as
communication, multicasting and File sending. During compared to 20 bytes in TCP (in order to guarantee
communication taking place there might be different system reliability).
and network failures occurring , which we have discussed and UDP is considered to be very useful in some
proposed a convenient solution for that. This system designed circumstances, especially in speed and network management.
with Java achieves a satisfying and efficient communication The fact that UDP lacks built-in reliability mechanisms can
between the users by experimental verification. be considered as an advantage from the application
designer's point of view. That is, communication between
Keywords-Chat Application, File sending, Multicasting, application processes can be achieved reliably without being
Transport Layer, UDP.
constrained by the transmission rate constraints imposed by
TCP's congestion control mechanism. UDP has a lower
I. INTRODUCTION latency as compared to TCP because it doesn’t wait for any
Open system interconnection (OSI) [1, 2] model is a lost packets whereas TCP waits for the lost packets until the
concept that describes how the data communication takes in transmission timeout occurs as shown in Fig 2. The most
a network. It consists of seven layers each performing some important feature regarding UDP is that it supports
set of functions regarding how a process gets completed in Multicasting and Broadcasting which can’t be implemented
the Network. OSI layer’s consist of physical, data link, in TCP protocol. Now in further paper we will look at the
Network, Transport, Session, Application and presentation past works and applications related to UDP .
layers. The transport layer [3, 4] is the fourth layer of the
OSI reference model which provides transparent transfer of II. RELATED WORK
data between end systems using the services of the network UDP is used only a few percent in a typical network.
layer. It is layered just below the ‘Session’ and sits above the There are some internet applications that use UDP such as
IP (Internet Protocol) in (OSI) model. This layer is Domain Name System (DNS) [8], Simple Network
interesting in a sense that it resides in the architectural center Management Protocol (SNMP) [8], Dynamic Host
of the model. Accordingly, it represents an important Configuration Protocol (DHCP) [8] and the Routing
transition point between the hardware-associated layers Information Protocol (RIP) [8]. Many chat room based
below it and the layers above that are more software-oriented application have been proposed like outlook, win popup,
and abstract. The transport layer helps layers above it, akeni but mostly all of them are implemented using TCP
providing them cost effective data transfer and reliability. It protocol which is considered reliable but doesn’t provide the
enables end-to-end control and information transfer which speed and Multicasting as such. For real time voice and
can be implemented in all the End Systems (ES). In general video streaming application UDP is preferred over TCP
there are two transport layer protocols TCP (Transmission because of its higher speed. This application doesn’t have
Control Protocol) and UDP (User Datagram Protocol). UDP
is a connection less transport layer protocol which supports
Network Application and establishes network
communication [5].
c
978-1-4244-6349-7/10/$26.00 2010 IEEE V6-374
A. Unicasting
Unicast transmission is the sending of messages to a
single network destination host as shown in Fig 3. This
method solves network traffic problems to deliver messages
from one host to another. So, we can say that this is one-to-
one data delivering method. For better understanding,
consider a situation where one computer’s request for a site
is received by all connected to the Internet. This way you are
actually flooding the Internet with such requests. Hence, you
Figure 1. TCP need Unicast transmission [12] for small and large networks.
Examples of Unicast transmission are HTTP, SMTP, etc and
it is still predominant in LANs.
B. Broadcasting
Broadcast [11, 12] is a type of transmission where data
sent by one host is received by every host present in the
network as shown in Fig 4. Taking the case of Dynamic
Host Configuration Protocol in which when a system boots
up and requests for an IP from DHCP server which system
is not aware of so it broadcasts the request of an IP
Figure 2. UDP
throughout the network. It is used to send same message to
all computers in LANs, e.g. Address Resolution Protocol
any impact on loss of a single packet. Chat applications (ARP) uses this technique to send an address resolution
using UDP socket has been made, but that doesn't have query to all. Most routers designed these days’ blocks IP
features of sending files and real time audio, video chat from broadcast traffic and restrict it to the local subnet.
one peer to another. Most of the modern multiplayer games C. Multicasting
[9] use UDP broadcast to start game, send messages and
information to other players. Another popular use of UDP is In this method, you can transmit data or messages to all
a tunneling protocol [10]. A tunnel endpoint encapsulates destination host machines, which has been interested an
the packets into UDP and transmits them to tunnel endpoint appropriate multicast group. The sender generates only one
which encapsulates the UDP datagram’s and forward the data stream but it delivered to all destination hosts in the
original packets. Tunnels are used to create virtual links that group as shown in Fig 5. It supports one-to-many data
looks like a direct connection between two locations that are delivering networks.
distant in the physical internet topology. Multicast [11, 12] delivers a data or information
simultaneously to all interested destination hosts machines.
III. TRANSMISSION METHODS Multicast is placed in a class 'D' IP address which has
addresses space from 224.0.0.0 to 239.255.255.255. In our
This section introduces you how to deliver or transmit
implementation we have generated a group IP for every
data in network and describes the fundamental of various
multicast group to communicate in a group. Whenever a
techniques like: unicast, broadcast and multicast. There are
client wants to create a group, server would provide an IP in
numerous methods for delivering or transmitting data in the
the above given pool of IP's and store the information (IP
network as discussed below.
and Port Number) of all the clients in the group. One good
example of Multicast based network is video transmission in
which one computer needs to transmit video channel to a
specific group of computers. This way, other computers
which are part of this Multicast IP network will be able to
receive same set of data at the same time. Multicast offers
savings on bandwidth and is the preferred way of data
Figure 3. Unicasting communication when data is to be transmitted to a set of
computers. Unlike broadcast transmission, multicast clients
receive stream of packets only if they have previously
elected to do so (by joining the specific multicast group
address). Membership of any group is controlled by the
receivers and is dynamic in nature.
IV. FILE SHARING
Some Peer-to-Peer (P2P) file sharing operation models
Figure 4. Broadcasting over asymmetric networks have several shortcomings that
[Volume 6] 2010 2nd International Conference on Computer Engineering and Technology V6-375
sending a file and creates a room where users selected by
him interact with each other.
A. Peer to Peer Communication
This module refers to communication between any two
clients. Sender sends the request containing its name and a
generated random port to the receiver. After receiving the
sender’s request at the receiver’s end communication is
Figure 5. Multicasting established by starting a thread on both sides. When a
network gets established between peers, a counter will be
may have a significant impact to the system and network initialized at both the sides which will depict the sequence
performance. Paths on which data transmission occurs are number of the packet. For every packet sent on either side
highly redundant, thereby wasting a lot of bandwidth. The there will be an acknowledgment from the other side which
downloading throughput of the peer node is limited by the will increase the counter with 1. So if any kind of failure
upward bandwidth of other peer nodes. Since in TCP each occurs as discussed later can be identified and a packet may
and every packet is being followed by an acknowledgement be sent again. For example: If A sends a message with
packet on the upward channel which results in the deteriorate sequence number 10 to B, B will reply back with an
of performance in sending a file .These shortcomings acknowledgement with sequence number 11.
severely effects the efficiency of Peer to Peer file sharing as
well as network performance. Peer to Peer File transfer B. Multicasting
between the client's will be in the various number of packets This feature can be implemented using the multicasting
.Whole file would be broken into chunks of binary data concepts. When a user wants to create a chat room for
which would be send to the destination where it would be multiple users, it sends a request to the server. Server then
combined to form a complete file. acknowledges this request by providing a group IP and sends
the information about the room to all the concerned users.
V. PROPOSED SOLUTION Now, in this room whenever a user wants to send a message
We have implemented this using Java platform which it will be multicast to all the users through the group IP.
would be through Socket Programming. Our solution Server-Client Model as depicted in the figure 6 shows
includes features like peer to peer communication, client’s k1, k2, k3 establishing connection with the server.
multicasting and files sharing. The chat application is a client When another client k4 sends a request to join, server
server model as shown in figure 6. processes its request by adding its information in the table
Server: We maintain a thread at server side which i.e. Name and IP. Similarly, as client k1 logs out, server
receives various incoming clients request. It stores the deletes the entry related to k1 and correspondingly updates
information of the clients i.e. IP address and name in a list. the table.
This list is then broadcasted to all the users. Contrary to this, C. File Sending
whenever a client logs out, it deletes that particular client
entry from its list and updates it accordingly. It also keeps In this module there would be feature in our chat window
track of various chat rooms, providing a group IP to each which would allow the user to send a file through the
multicast group. network to the other user. When any user wants to send a file
to other user a message would appear on the receiver’s side
that whether he/she wants to accept it or not. After the
acceptance from the receiver whole file would be read and
send it to the receiver in the segments of 65,000 bytes and
finally at the receiver’s end the segments would be received
and stored in a buffer and clubbed according to the sequence
number. There would be confirmation message after
receiving the file.
D. Failure Model
During our implementation, we incurred various kinds of
failures for which we proposed the solution in the following
manner. As depicted in the Fig 7, we have discussed both
system and network failure. In system failure, either a server,
V6-376 2010 2nd International Conference on Computer Engineering and Technology [Volume 6]
sender or receiver may get failed due to some unforeseen the implementation was to identify the packets which we
handled by accompanying the packet with a particular type
of string. Cryptographic algorithms [13] can be used to
secure the data and files that are being sent from one peer to
another. To increase the robustness we have used
acknowledgments with every packet being sent. This design
has some basic requirements of a chat room like instant
messaging, multicasting and file sending. We get messages
in order which we sent.
[Volume 6] 2010 2nd International Conference on Computer Engineering and Technology V6-377