Computer Systems: A Programmer's Perspective (3rd Edition)
Computer Systems: A Programmer's Perspective (3rd Edition)
3rd Edition
ISBN: 9780134092669
Author: Bryant, Randal E. Bryant, David R. O'Hallaron, David R., Randal E.; O'Hallaron, Bryant/O'hallaron
Publisher: PEARSON
Question
Book Icon
Chapter 11.4, Problem 11.4PP
Program Plan Intro

IP addresses:

  • The IP address denotes an unsigned integer that is 32-bit.
  • The IP addresses is been stored by network programs in IP address structure.
  • The addresses present in IP address structure are stored in network byte order.
  •  An unsigned 32-bit integer is converted from host byte order to network byte order by “htonl” function.
  • An unsigned 32-bit integer is converted from network byte order host byte order by “ntohl” function.
  • The IP address is presented to humans in a form known as “dotted-decimal” notation.
    • Each byte is been represented by its corresponding decimal value and is separated by a period from other bytes.

The getaddrinfo Function:

  • It converts string representation of hostnames, host addresses, service names and port numbers into structures of socket address.
  • It denotes replacement for “gethostbyname” and “getservbyname” functions.
  • The two components of socket address denote “host” and “service”, the method returns result that points to a linked list of “addrinfo” structures.
  • The “host” argument can either be a domain name or a numeric address.
  • The “service” argument can be either a service name or a decimal port number.

The getnameinfo Function:

  • It converts structures of socket address to corresponding host and service name strings.
  • It denotes replacement for “gethostbyaddr” and “getservbyport” functions.
  • The argument “sa” points to a structure of socket address with size “salen” bytes.
  • It points to host with buffer of size “hostlen” bytes and “service” to a buffer of size “servlen” bytes.
  • The result is been copied into “host” and “service” buffers.
  • If it returns a non-zero error code, the application can convert it to a string by calling “gai_strerror”.

Blurred answer
Students have asked these similar questions
[ Direction: Any how solve the question please. Don't reject the question. if you need 2 /3 hours to solve the question please take it but don't reject the question. solve it properly,correctly.You can consult any resources such as books, online references, and videosfor this assignment, however, you have to properly cite and paraphrase your answerswhen it is necessary. ]  The following figure represents both datapathand controlpath for MIPS architecture that implements most of thefundamental instrucons.
Question 5 Multiple Choice: We have been assigned the task of selecting an interface language for a disk controller that must count disk reads. In particular, the controller must count how many reads have occurred since the last write to the disk and confirm that the count of reads does not exceed 1,000,000. Two proposals have been made. Method C uses C++ while Method R uses regular expressions. Then I would use Method C because Method R would translate into a finite automaton with at least 1,000,000 states. I cannot use Method C because it is not able to keep track of the count of reads. I would use Method C because Method R cannot keep track of the count of reads. I cannot use Method R because regular expressions cannot represent integers.
Please refer to this textbook: “A. Silberschatz, P. B. Galvin and G. Gagne, “Operating System Principles,”7th Edition, John Wiley & Sons Inc., 2006.”   And answer the following questions: Question7: A practical way to handle network partitioning is to: (a) Have each process start an election. (b) Elect a leader only if a majority of nodes can be reached. (c) Run a normal election and multicast the result to the subset of processes that can be reached. (d) Divide and conquer: elect multiple coordinators.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education