Sunteți pe pagina 1din 9

The National Law Institute University, Bhopal

Programmer Offers

Master of Science

In

Cyber Law and Information Security

PROJECT

To Study on Ports Sockets

SUBJECT

Introduction to Hardware, Network, the Internet and Programming

SUBMITTED TO: SUBMITTED BY:

Mr. Astitwa Bhargava Hemant Vishwakarma

2017-MSCLIS-27
INDEX
Abstract
INTRODUCTION
In computer networking, a port is an application-specific or process-specific software construct serving as
a communications endpoint in a computer's host operating system. A port is associated with an IP address
of the host, as well as the type of protocol used for communication. The purpose of ports is to uniquely
identify different applications or processes running on a single computer. The protocols that primarily use
ports are the Transport Layer protocols, such as the Transmission Control Protocol (TCP) and the User
Datagram Protocol (UDP). They use port to map incoming data to a particular process running on
computer. So port will identify the sockets on a host.

Socket allows communication between two different processes on the same or different machine. A
sockets is a software concept for a connection. Socket enables application to connect to a TCP/IP
network. An application running on a host creates a sockets or a doorway to connect with an application
on another host. Messages pass through this sockets or doorway
Ports
1
A network port is a process-specific or an application specific software construct serving as a
communication endpoint, which is used by the transport layer protocol suite such as user
datagram protocol (UDP) and transmission control protocol (TCP). The TCP and UDP protocol
use ports to map incoming data to a particular process running on a computer. Ports are used to
identify the processes in the running application on the host, which is identify by the well known
ports number assigned by the IANA (internet assigned number authority).

1
Available at https://www.techopedia.com/definition/24717/network-port
Sockets
A socket is a one endpoint of two way communication link between two programmes running on
the network. A socket is bound to a port number so that the TCP layer can identify the
application that data is destined to be send to.

fig:1
An endpoint is the combination of an IP address and port number. Every TCP connection can be
uniquely identify by its two endpoints. That way you can have multiple connection between your
host and the server.

fig:2
A server runs on a specific computer and has a socket that is bound to a specific port number.
The server just waits listening to the socket of the client to make a connection request.2

Socket Address
In the standard Internet protocols TCP and UDP, a socket address is the combination of an IP
address and a port number, much like one end of a telephone connection is the combination of a
phone number and a particular extension. For example in fig:3 the sockets address has given that
is 200.23.56.8:69 in it 200.23.56.8 is IP address and 69 is a port number.
fig:3

2
Available at https://docs.oracle.com/javase/tutorial/networking/sockets/definition.html
Sockets Communication
A server runs on a specific computer has a sockets that is bound to a specific port. The server
waits and listens to a socket for a client to make a connection request. The clients make a
connection request knowing the host name and the port number on which the server is listening.
The client bind to its local port number that it will use during the connection.
Its need a new socket so that it can continue to listen to the original sockets for connection
request while tending to the needs of the connected client. If connection is established, the server
gets a new socket bound to the same local port and also has its remote endpoint set to the address
and port of the client. If the connection is accepted by the client, a socket is successfully created
and the client can use the socket to communicate with the server. The client and server can now
communicate by using their sockets. Fig:4 shows how socket communication happens.3

1 TYPES OF SOCKETS
There are four types of sockets available to the users. The first two are most commonly used and
the last two are rarely used. Process is presumed to communicate only between sockets of the

3
Available at https://www.slideshare.net/myrajendra/ports-sockets?qid=ed7cf395-2d17-4fec-8eaa-
c60dc80f7ed8&v=&b=&from_search=1
same type but there is no restriction that prevents communication between sockets of different
types.

STREAM SOCKETS
Delivery in a networked environment is guaranteed. if you send through the stream socket three
item A,B,C, they will arrive in the same order A,B,C. These sockets use TCP (transmission
control protocol) for data transmission. If delivery is impossible, the sender receives an error
indicator. Data records do not have any boundaries.

DATAGRAM SOCKETS
Delivery in a networked environment is not guaranteed. Theyre connectionless because you
dont need to have an open connection as in stream sockets .you build a packet with the
destination information and send it out. They use UDP (user datagram protocol).

RAW SOCKETS
These provide users access to the underlying communication protocols, which support socket
abstractions. These sockets are normally datagram oriented, though their exact characteristics are
dependent on the interface provided by the protocol. Raw sockets are not intended for the general
user; they have been provided mainly for those interested in developing new communication
protocols, or for gaining access to some of the more cryptic facilities of an existing protocol.

SEQUENCED PACKET SOCKETS


They are similar to a stream socket, with the exception that record boundaries are preserved. This
interface is provided only as a part of the Network Systems (NS) socket abstraction, and is very
important in most serious NS applications. Sequenced-packet sockets allow the user to
manipulate the Sequence Packet Protocol (SPP) or Internet Datagram Protocol (IDP) headers on
a packet or a group of packets, either by writing a prototype header along with whatever data is
to be sent, or by specifying a default header to be used with all outgoing data, and allows the user
to receive the headers on incoming packets.4

2 http://microchipdeveloper.com/com4104:sockets
https://docs.oracle.com/javase/tutorial/networking/sockets/definition.html

https://www.techopedia.com/definition/24717/network-port

4
Available at https://www.tutorialspoint.com/unix_sockets/what_is_socket.htm

S-ar putea să vă placă și