GupShup Study
 
  
Pankaj Yadav

Socket Vs Port

07-May-2016 | | Total View : 257 |

Port:   In simple language,  "Port" is a number used by a particular software to identify its data coming from internet. 

Each software like, skype, chrome, youtube has its own port number and thats how skype or youtube knows which internet data is for itself.

Socket: "IP address and Port " together is called "Socket". It is used by another computer to send data to one particular computer's particular software.

IP address is used to identify the computer and Port is to identify the software such as IE, Chrome, Skype etc.

 

 

-------------------------------------------------------------------------------------------------------

A socket is a network communications endpoint. The analogy is to a wire (the network data connection) being plugged into a socket.

Sockets come in two primary flavors. An active socket is connected to a remote active socket via an open data connection. Closing the connection destroys the active sockets at each endpoint. A passive socket is not connected, but rather awaits an incoming connection, which will spawn a new active socket.

A socket is not a port, though there is a close relationship between them. A socket is associated with a port, though this is a many-to-one relationship. Each port can have a single passive socket, awaiting incoming connections, and multiple active sockets, each corresponding to an open connection on the port.

A port is a logical connection method two end points communicate with. Ports operate at the Transport layer of the OSI.

Sockets are a means of plugging the application layer in. Sockets are determined by an IP address and port number.A socket is one end point of a connection.

 

=================================================

Socket is the API's abstraction for a IP-port pair. It handles the network and transfer layer of communication. It can be thought of as a application's interface to the network.

A port on the other hand is the destination/origin of a packet. A IP address is further divided into ports so that applications can share the network without conflict.

 

 

 

Reference :: http://pro-programmers.blogspot.in/2009/02/socket-vs-port.html

Share With Friends :  
Devika Jain
08-May-2016

Devika Jain

Hello Mr. Pankaj.

Pankaj Yadav
08-May-2016

Pankaj Yadav

hi...