Question

In: Computer Science

Define sockets

Define sockets

Solutions

Expert Solution

Definition:

A socket is one endpoint of a two-way communication link between two programs 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 sent to.

Socket communications are bidirectional.

Within the operating system and the application that created a socket, a socket is referred to by a unique integer value called a socket descriptor.

On the client-side: The client knows the hostname of the machine on which the server is running and the port number on which the server is listening. To make a connection request, the client tries to rendezvous with the server on the server's machine and port. The client also needs to identify itself to the server so it binds to a local port number that it will use during this connection. This is usually assigned by the system.

If everything goes well, the server accepts the connection. Upon acceptance, 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. It needs a new socket so that it can continue to listen to the original socket for connection requests while tending to the needs of the connected client.

On the client-side, if the connection is accepted, 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 writing to or reading from their sockets.

Use:

A process can refer to a socket using a socket descriptor, a type of handle. A process first requests that the protocol stack create a socket, and the stack returns a descriptor to the process so it can identify the socket. The process then passes the descriptor back to the protocol stack when it wishes to send or receive data using this socket.

Unlike ports, sockets are specific to one node; they are local resources and cannot be referred to directly by other nodes. Further, sockets are not necessarily associated with a persistent connection (channel) for communication between two nodes, nor is there necessarily some single other endpoints. For example, a datagram socket can be used for connectionless communication, and a multicast socket can be used to send to multiple nodes. However, in practice for internet communication, sockets are generally used to connect to a specific endpoint and often with a persistent connection.

Types of Sockets:

Several types of Internet socket are available:

  • Datagram sockets, also known as connectionless sockets, which use User Datagram Protocol (UDP).
  • Stream sockets, also known as connection-oriented sockets, which use Transmission Control Protocol (TCP), Stream Control Transmission Protocol (SCTP) or Datagram Congestion Control Protocol (DCCP).
  • Raw sockets (or raw IP sockets), typically available in routers and other network equipment. Here the transport layer is bypassed, and the packet headers are made accessible to the application, and there is no port number in the address, just the IP address.

Stream Sockets − Delivery in a networked environment is guaranteed. If you send through the stream socket three items "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. They're connectionless because you don't 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.


Related Solutions

1. What are the functions of sockets in networked applications? Explain your answer with a case...
1. What are the functions of sockets in networked applications? Explain your answer with a case scenario where you are receiving 10 packets from a node. How will the socket perform its role? [5 Marks] 2. YouTube is an example of stored multimedia type application, discuss the challenges and solutions of YouTube while playing multimedia (audio/video) based stored content. Justify your answer with an example (playing a stream and taking screenshots to explain). [5 Marks]
1. What are the functions of sockets in networked applications? Explain your answer with a case...
1. What are the functions of sockets in networked applications? Explain your answer with a case scenario where you are receiving 10 packets from a node. How will the socket perform its role? [5 Marks] 2. You**** is an example of stored multimedia type application, discuss the challenges and solutions of YouT*** while playing multimedia (audio/video) based stored content. Justify your answer with an example (playing a stream and taking screenshots to explain).
What are the functions of sockets in networked applications? Explain your answer with a case scenario...
What are the functions of sockets in networked applications? Explain your answer with a case scenario where you are receiving 10 packets from a node. How will the socket perform its role?
What are the functions of sockets in networked applications? Explain your answer with a case scenario...
What are the functions of sockets in networked applications? Explain your answer with a case scenario where you are receiving 10 packets from a node. How will the socket perform its role? [5 Marks] 2. youtub is an example of stored multimedia type application, discuss the challenges and solutions of youtub while playing multimedia (audio/video) based stored content. Justify your answer with an example (playing a stream and taking screenshots to explain). [5 Marks] Anwer in detail
(learning about sockets) can I have an example of how to use child threads in a...
(learning about sockets) can I have an example of how to use child threads in a client.cpp to send info to a server.cpp. and how a server.cpp uses child processes to send back info to the client
What are the pros and cons of data exchange using pipes/sockets vs data exchange using shared...
What are the pros and cons of data exchange using pipes/sockets vs data exchange using shared memory.
What are the pros and cons of data exchange using pipes/sockets vs data exchange using shared...
What are the pros and cons of data exchange using pipes/sockets vs data exchange using shared memory.
Little Company borrowed $56,000 from Sockets on January 1, 2018, and signed a three-year, 7% installment...
Little Company borrowed $56,000 from Sockets on January 1, 2018, and signed a three-year, 7% installment note to be paid in three equal payments at the end of each year. The present value of an ordinary annuity of $1 for 3 periods at 7% is 2.62432. Required: 1. Prepare the journal entry on January 1, 2018, for Sockets’ lending the funds. 2. Calculate the amount of one installment payment. 3. Prepare an amortization schedule for the three-year term of the...
Little Company borrowed $51,000 from Sockets on January 1, 2021, and signed a three-year, 7% installment...
Little Company borrowed $51,000 from Sockets on January 1, 2021, and signed a three-year, 7% installment note to be paid in three equal payments at the end of each year. The present value of an ordinary annuity of $1 for 3 periods at 7% is 2.62432. Required: 1. Prepare the journal entry on January 1, 2021, for Sockets’ lending the funds. 2. Calculate the amount of one installment payment. 3. Prepare an amortization schedule for the three-year term of the...
Define the social self and how it is developed. Define individualistic and collectivistic cultures. Define the...
Define the social self and how it is developed. Define individualistic and collectivistic cultures. Define the fundamental attribution error. Discuss how culture is most likely to make the fundamental attribution error and why. Include the role this plays in the development of the social self.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT