Menu

Refer Figure 1 Snippet Code Fourteen Deliberate Errors Introduced Code Eleven Errors Ident Q43829819

Refer to Figure 1 - A snippet of code. There are fourteen deliberate errors introduced in this code; eleven of the errors are

Refer to Figure 1 – A snippet of code. There are fourteen deliberate errors introduced in this code; eleven of the errors are identified with XXXX and three relate to the sequencing of the Socket Primitive calls. You are required to: (1) Replace the values XXXX with the correct code. Use the line numbers to identify where your corrections are made. Note the text “XXXX” is merely a placeholder and does not signify the same code to be replaced in each instance. (10 marks) (1) Identify the correct line number where the out-of-sequence Socket Primitive calls (and any other lines normally associated with that primitive call) should be placed. (6 marks) (ID) Identify the type of application this is: client or server. Also, identify what application layer protocol it is adhering to and the next socket primitive to be called in relation to this application layer protocol. (4 marks) 1. 2. 11 connect (Xxxx, (SA ) &servadde, sizeof(servadd)) < 0) err_sys “connect error”); if ( (hp – DOCX (www.dit.ie”) = NULL) err_quit (“hostname error”, hstrerror (h_errno)); 9. snprintf (sbuff, sizeof(sbuf), “HELO aisling.student.comp.dit.iern”); Write (300X, DOCX, strlen (CC) ); 10. pptr – hp->h_addr_list; 12. bzero (XOCX, sizeof(XIX)); 13. servaddr.sin family = AF INET; 14. servaddr.sin port – docx (atoi (argv[2])); 15. mencpy(servaddr.sin_addr, yox, sizeof(2000X)); 17. if ( socked – socket (OX, SOCK_STREAM, 0)) <0) 18. err_sys(“socket error”); Figure 1: A snippet of code Show transcribed image text Refer to Figure 1 – A snippet of code. There are fourteen deliberate errors introduced in this code; eleven of the errors are identified with XXXX and three relate to the sequencing of the Socket Primitive calls. You are required to: (1) Replace the values XXXX with the correct code. Use the line numbers to identify where your corrections are made. Note the text “XXXX” is merely a placeholder and does not signify the same code to be replaced in each instance. (10 marks) (1) Identify the correct line number where the out-of-sequence Socket Primitive calls (and any other lines normally associated with that primitive call) should be placed. (6 marks) (ID) Identify the type of application this is: client or server. Also, identify what application layer protocol it is adhering to and the next socket primitive to be called in relation to this application layer protocol. (4 marks) 1. 2. 11 connect (Xxxx, (SA ) &servadde, sizeof(servadd)) h_addr_list; 12. bzero (XOCX, sizeof(XIX)); 13. servaddr.sin family = AF INET; 14. servaddr.sin port – docx (atoi (argv[2])); 15. mencpy(servaddr.sin_addr, yox, sizeof(2000X)); 17. if ( socked – socket (OX, SOCK_STREAM, 0))

Expert Answer


Answer to Refer to Figure 1 – A snippet of code. There are fourteen deliberate errors introduced in this code; eleven of the error…

OR