Commit 0652778f authored by cdf009's avatar cdf009

part 3

parent ece92c25
1)If no calls were made to fork in either of the programs you have, why is it that we’re claiming that TCP sockets are a mechanism for interprocess communication?
We consider this an interprocess communication because a TCP socket interconnects two processes that execute on arbitrary machines. The processes can execute on either the same host or networked hosts. The fork is not needs beceuase the processes can be run on differtent machines as long as theyre networked together. This is why we use the host and the port number.
2) Is the socket functionality provided by the kernel or by an external library? Present an argument to justify your answer from the perspectives of the actual implementation on Linux and from the perspective of the design decisions made for the construction of the operating system (think about the implications of these decisions on the performance of a modern networked computer). You should think about what makes sense, do a little research to verify whether you are on the right track, reason about your findings, and only then write your conclusions.
I would believe that the socket functionality is provided by the kernal. I believe this because the host is unique to your network and computer. The connection of sockets in this cases also uses many syscalls working together to make connections and finsh the task. In this case, we use send/recieve so that messages can be sent accross the connection. We also use connect and bind to solidfy and create connections. These are all operations that are done by the kernel and not a external library.
3) Only when you consider a program’s communications needs and the operational constraints around a program can you choose which of the two IPC mechanisms is most appropriate. Describe what drives you decision to use either pipes and sockets to interconnect two processes.
I personally think sockets are much more useful to interconnect the two processes. Sockets give you much more freedom to connect with other computers and other ports. The sockets use syscalls to be set up and maintained. While pipes are also useful, they are unidirectional and require many more compoenents to get the job done.
4)echoreq makes a call to gethostbyname(3). Explain what this library call does for your program and how you use its API.
This function call will call the host and return the host structure. This is useful for our program because you are required to provide the host in order to make the connection between the two functions. Therefore, the host has to match up for any connection and data to be passed accross.
5)gethostbyname(3) is not the most up-to-date function for its kind of task (it is deprecated). Discover what function might eventually replace gethostbyname(3) and explain how differently it might work.
I would use gethostbyaddr as it returns much much more data to work with and make connections with. It works differently in that it provides us with different return data. This is all because it is very descriptive when it takes in the attributes. It wants the addr, len and type. Therefore, you are able to be much more specific with the host.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment