The paper “ Computer Networks Problem Solving” is a forceful variant of assignment on information technology. Socket API is a service model that works on the TCP protocol of the application layer. Sockets are defined as the created endpoints on both the sender and receiver that establish a service. Each socket is comprised of a host IP address and a 16-bit number that is local to the particular host otherwise referred to as a port. The TCP connection management employs the use of API calls to communicate between the client and the server.
They include: accept, bind, close, connect, listen, receive, send, and socket. Their functionalities are as described below, each being executed depending on the previous state of service: Accept: This event is also referred to as acknowledge, abbreviated as ACK. It is a response issued by a local TCP entity to acknowledge a SENT request made by a client. This event happens when a client sends a connect request, and is responded when the finite state machine goes to the state SYN-SENT. Upon the arrival of the event SYN+ACK, the finite machine switches to the state Established and upon which data can then be sent or received. Bind: The Bind () socket call is initiated by the server to the client and it associates the client to a client who can use the address parsed as an argument to establish a connection.
The bind system call is invoked when the address in focus is local as opposed to the remote terminal. The bind call is followed by the listen to system call and takes in as arguments, the port, and address pair. Close: This system call, is used to initiate the “ closed” state in the finite state machine (FST).
Its role is to terminate all open connections either on the server-side or the client-side. On the server-side, it is preceded by a write operation while on the client-side it is preceded by a read operation. Connect: The functionality of this system call is to set the connection to an active open state. The event created by this call is a user-initiated system call and is received by the server. The connect system call originates from the client to the server which seeks to establish a connection.
On the server-side, the accept() call is blocked until the connection from the client is established. Listen: This system call operates on the server-side, also the receiver. It is precedent to the ACCEPT system call and proceeds the BIND call. This call initiates a “ passive” connection state on the server and the server waits for a connection to be established. (A. Tanenbaum, D. Weatherall, 2011,501) Receive: This call works with a control segment SYN to confirm the arrival of a connection.
The FST is then switched to the SYN RCVD state and waits for an acknowledgment signal. Send. The function of this call is causing the state to change from LISTEN to SYN-SENT in the finite state machine. The send primitive starts the transmission of the data segment between the cline and the server. Socket: This primitive is used to establish an inter-process communication on both the client and the server-side. It precedes all other system calls since information using the TCP protocol can only be established by the use of sockets.
Hence, it is initiated before the “ connect” primitive is called to initiate the setup. The “ socket ()” system call specifies the domain and the socket type before two processes can communicate with each other. To be precise, the two processes can communicate only if the sockets exchanged are of the same type. (A. Tanenbaum, D. Weatherall, 2011, 563)
ReferencesA. Tanenbaum, D. Weatherall, 2011. Computer Networks. 5TH ed. Boston, Massachusetts: Pearson Education Inc.