Question: Given the code above, to get responses from the server, the TCP client program should register for a source port number, but in the program,

 Given the code above, to get responses from the server, the
Given the code above, to get responses from the server, the TCP client program should register for a source port number, but in the program, this step seems to be missing. Without this port number, how can the client program get responses? (2) Which line of the code triggers the three-way handshake protocol? (3) There are two write() calls in this client program, will each call trigger a separate TCP packet? 

#include #include #include include int main () // Step 1: Create a socket int sockfd socket (AF_INET, SOCK_STREAM, 0) // Step 2: Set the destination information struct sockaddr_in dest; memset (&dest, 0, sizeof (struct sockaddr_in)); dest. sin-family AF_INET; dest . sin-addr. s_addr = inet_addr ( " 10 . 0 . 2 . 17" ) ; dest . sin_port = htons (9090); // Step 3: Connect to the server connect (sockfd, (struct sockaddr)&dest sizeof (struct sockaddr_in)); // Step 4: Send data to the server char *buffer! - "He 0 Server ! "; char buffer2 - "Hello Again! "; write (sockfd, bufferl, strlen (bufferl)); write (sockfd, buffer2, strlen (buffer2)); // Step 5: Close the connection close (sockefd) return 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!