Electronics > Solutions Guide > Section One (All)
Section One With the help of a neat sketch explain the steps and buffers involved when an application writes to a TCP socket. The steps for establishing a TCP socket on the client side are the foll ... owing: Create a socket using the socket() function; Connect the socket to the address of the server using the connect() function; Send and receive data by means of the read() and write() functions. Close the connection by means of the close() function. The steps involved in establishing a TCP socket on the server side are as follows: Create a socket with the socket() function; Bind the socket to an address using the bind() function; Listen for connections with the listen() function; Accept a connection with the accept() function system call. This call typically blocks until a client connects with the server. Send and receive data by means of send() and receive(). Close the connection by means of the close() function. Below is each function described with its importance: 1. The socket() Function It specifies the type of communication protocol (TCP based on IPv4, TCP based on IPv6, UDP). The function is defined as follows: #include <sys/socket.h> int socket (int family, int type, int protocol); Where family specifies the protocol family (AF_INET for the IPv4 protocols), type is a constant described the type of socket (SOCK_STREAM for stream sockets and SOCK_DGRAM for datagram sockets. [Show More]
Last updated: 3 years ago
Preview 1 out of 6 pages
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
Aug 10, 2022
Number of pages
6
Written in
All
This document has been written for:
Uploaded
Aug 10, 2022
Downloads
0
Views
86
Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·