Socket Identifier?

This is a discussion on Socket Identifier? within the Networking/Device Communication forums, part of the General Programming Boards category; Hello Experts,
My Doubts:
1) I have heard that Socket is an endpoint residing on the host. If so then ...

1) I have heard that Socket is an endpoint residing on the host. If so then how a socket is uniquely identified?

Most sockets are represented by an int, which is then passed to functions that connect/send/receive/perform other operations on it. The actual socket itself is a structure, but the user never sees that part.

Originally Posted by sumit180288

2) Can this endpint communicate with multiple sockets on remote hosts?

1) TCP socket: multiple sockets can be bound to a single port in this case. These are the ESTABLISHED or Active Sockets , the ones which are Exchanging the data. The Other Type of TCP socket is a passive socket which listens to incoming connections and only one PASSIVE Socket can be bound to a port. (on the contrary multiple ACTIVE sockets can be bound to a same port)

2) UDP Socket: It is a socket which will itself handle all the data by itself serially, destined to itself (on the contrary TCP socket will spawn a new ACTIVE socket to handle the new incoming Clients.

Originally Posted by sumit180288

Hello Experts,

My Doubts:

1) I have heard that Socket is an endpoint residing on the host. If so then how a socket is uniquely identified?

2) Can this endpint communicate with multiple sockets on remote hosts?

Either way, there's many different types of protocols (TCP/UDP being some of them), but three different types of sockets. Raw (packet) sockets that send data as it is gotten from the user, datagram sockets that encapsulate the data in datagrams ( UDP uses this ), and connected sockets which rely on a handshake system (TCP).