DOC PREVIEW
GT ECE 4110 - ECE4110, Internetwork Programming, QUIZ 1

This preview shows page 1 out of 4 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 4 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 4 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Name (Print) ______________________________ Email Address ECE4110 Quiz 1 p. 1 ECE4110, Internetwork Programming, QUIZ 1 Fall 2005 Prof. John A. Copeland Feb. 21, 2006 Tel.: 404-894-5177 E-Mail: [email protected] RULES. i This quiz is open book and notes (but no old quizzes). Calculators may be used. ii Answer all questions and show all work to receive full credit. Use back of sheets only if necessary. iii All sub-questions have the same weight. iv Please do not ask the proctors any questions during the exam about exam questions. Part of the test is understanding the question, as written, without supplemental information. If you feel additional data is needed to solve the problem, make (and state) an assumption and then work the problem. v. This is a time-limited test. All papers must be turned in 50 minutes after the start. If you find you are taking more than 10 minutes on a particular problem, move on and come back to that problem after finishing the others. The Georgia Honor Code applies (see last page). Question 1 –Server coding. What network function sets up a socket and returns the Socket Descriptor used later? a. socket() What three pieces of network information are stored in a "struct sockaddr_in" structure? b. network "family" AF_INET c. the IP address (wild card 0 for any local address) d. the port to listen on (usually a "well-known" port for the type of server What function ties the above three items to a socket? e. bind(_) What function makes the host ready to receive a packet on the designated port number (creates a listening socket)? f. listen(_) What function gets a packet (a pointer to the buffer and length of the data) coming to the designated port number and returns the Connection Descriptor of the new active socket? g. accept() What function can be used to send data back out the new active socket? h. write() What function will terminate the new active socket? i. close() A tcp or udp client will use "a" through "d" above. What is the next network function the client uses the create a new active socket? j. connect()Name (print) ______________________________ ECE4110 Quiz 1 p. 2 of 4 Question 2 – Network Conversion Functions Name a network function (if any) that can be used to do the following: a. Find the 32-bit integer for a dotted decimal IP address: inet_ptoh() b. Find the dotted-decimal IP-address text from a 32-bit integer: inet_htop c. Convert an "unsigned char" ( uint8 t ) to network order: not needed On an Intel Pentium CPU based host, what is the result (in hex) of the following: d. htonl( 0x1a2b3c4d ) = 0x 4d3c2b1a e. htonl( 0x1a2b ) = 0x 2b1a0000 f. htons( 0x1a2b ) = 0x 2b1a On an Sun Sparc or Apple G4 CPU based host, what is the result (in hex) of the following: g. htonl( 0x1a2b3c4d ) = 0x 1a2b3c4d Question 3 – C Code If "pd" is a pointer to a structure of type "date" which has a first element "year", struct date today, *pd ; today.year = 2006 ; pd = & today ; // pd = 0x8123abcd (memory address assigned to "today" by compiler) What is the value of (may be undefined): pd -> year = 2006 (a) (*pd).year = 2006 (b) *(pd.year) = Not defined ("pd" is not a structure) (c) Add comments to explain what the designated lines of code below are doing. struct item { // structures of this type will be used to build a linked list of function names and integer ID's (d) int id ; // exact value of identifying integer int * func ; // a pointer to a function (the name of a function) struct item * next ; // points to next structure in the list (e) } struct item * start[ 16 ] ; // array of 16 pointers to "item" structures (f) // Code here to fill many "item" structures and array start[] with values. int *find_func( int x) // used to find the function associated with the integer "x" (g) { struct item * pi ; pi = start[ x & 0x000f ] ; // pointer to an "item" structure from "start[]" array, index is hash of "x" (h) while( pi ! NULL ) { if( pi->id == x ) return( pi->func ) ; // normally returns the function pointer (function name) (i) pi = pi->next ; } return( NULL ) ; // returns NULL when no function is associated with integer "x" (j) }Name (print) ______________________________ ECE4110 Quiz 1 p. 3 of 4 Question 4 – Connection Initiation Host "A" wants to set up a Web access to www.cnn.com. List below the packets or frames sent and received by Host A until the TCP connection is Active (TCP handshake complete). Indicate under "Request" the information (question or answer) in a requesting or answering packet or frame. Indicate in column five if an IP packet is using TCP or UDP. For TCP packets also indicate the TCP Flag bits that are true (S - Syn, F - Fin, A - Ack, R - Reset) Show only the last two bytes of the Ethernet address (Host A = f0:a6). If not an IP packet, leave columns 3-5 blank. Source Ethernet Addr. Destination Ethernet Addr. Source IP Address Destination IP Address TCP+ Flag(s) or UDP Request (who is ...) or Response (ans: ...) f0:a6 ff:ff* who has 209.180.16.1 3a:07 f0:a6 ans: 3a:07 f0:a6 3a:07 209.180.16.4 130.207.244.244 UDP who is "www.cnn.com" 3a:07 f0:a6 130.207.244.244 209.180.16.4 UDP Ans: 130.207.244.24 f0:a6 3a:07 209.180.16.4 130.207.244.24 TCP - S 3a:07 f0:a6 130.207.244.24 209.180.16.4 TCP - SA f0:a6 3a:07 209.180.16.4 130.207.244.24 TCP - A * Ethernet Broadcast Address is ff:ff:ff:ff:ff:ff Question 5 – CIDR Routing Table Host X IP address is 209.180.18.150 on a "209.180.16.0 /20" network. Calculate the following: a. Host X IP address in hex: 0x d1 64 12 96 b. Host X IP address in binary: 1101 0001 1000 000 0000 1101 1001 0110 c. Host X network mask in hex: 0x ff ff f0 00 d. Host X network mask in binary: 1111 1111 1111 1111 1111 0000 0000 0000 e. Host X IP broadcast address in hex: 0x d1 64 1f ff f. Host X IP broadcast address in binary: 1101


View Full Document

GT ECE 4110 - ECE4110, Internetwork Programming, QUIZ 1

Documents in this Course
PUSH Flag

PUSH Flag

17 pages

Ethernet

Ethernet

33 pages

Load more
Download ECE4110, Internetwork Programming, QUIZ 1
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view ECE4110, Internetwork Programming, QUIZ 1 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view ECE4110, Internetwork Programming, QUIZ 1 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?