Seminar Topics & Project Ideas On Computer Science Electronics Electrical Mechanical Engineering Civil MBA Medicine Nursing Science Physics Mathematics Chemistry ppt pdf doc presentation downloads and Abstract

Full Version: Socket Programming
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Socket Programming

[attachment=66348]


INTRODUCTION

Internet and WWW have emerged as global ubiquitous media for communication and changed the way
we conduct science, engineering, and commerce. They are also changing the way we learn, live, enjoy,
communicate, interact, engage, etc. The modern life activities are getting completely centered around or
driven by the Internet.
To take advantage of opportunities presented by the Internet, businesses are continuously seeking new
and innovative ways and means for offering their services via the Internet. This created a huge demand
for software designers and engineers with skills in creating new Internet-enabled applications or porting
existing/legacy applications to the Internet platform. The key elements for developing Internet-enabled
applications are a good understanding of the issues involved in implementing distributed applications and
sound knowledge of the fundamental network programming models.


Hosts Identifi cation and Service Ports

Every computer on the Internet is identifi ed by a unique, 4-byte IP address . This is typically written in
dotted quad format like 128.250.25.158 where each byte is an unsigned value between 0 and 255. This
representation is clearly not user-friendly because it does not tell us anything about the content and then it is
diffi cult to remember. Hence, IP addresses are mapped to names like www.buyya.com or www.google.com,
which are easier to remember. Internet supports name servers that translate these names to IP addresses.
In general, each computer only has one Internet address. However, computers often need to communicate
and provide more than one type of service or to talk to multiple hosts/computers at a time. For example,
there may be multiple ftp sessions, web connections, and chat programs all running at the same time. To
distinguish these services, a concept of port s, a logical access point, represented by a 16-bit integer number
is used. That means, each service offered by a computer is uniquely identifi ed by a port number. Each
Internet packet contains both the destination host address and the port number on that host to which the
message/request has to be delivered. The host computer dispatches the packets it receives to programs by
looking at the port numbers specifi ed within the packets. That is, IP address can be thought of as a house
address when a letter is sent via post/snail mail and port number as the name of a specifi c individual to
whom the letter has to be delivered.


UDP SOCKET PROGRAMMING

The previous two example programs used the TCP sockets. As already said, TCP guarantees the delivery of
packets and preserves their order on destination. Sometimes these features are not required and since they
do not come without performance costs, it would be better to use a lighter transport protocol. This kind of
service is accomplished by the UDP protocol which conveys datagram packet s.
Datagram packets are used to implement a connectionless packet delivery service supported by the UDP
protocol. Each message is transferred from source machine to destination based on information contained
within that packet. That means, each packet needs to have destination address and each packet might be
routed differently, and might arrive in any order. Packet delivery is not guaranteed