What socket type should be used to implement an intercomputer file-transfer program?What type should be used for a program that periodically tests to see whether another computer is up on the network?Explain your answer.
Answer:Sockets of type SOCK STREAM use the TCP protocol for communicating data.The TCP protocol is appropriate for implementing an intercomputer file-transfer program since it provides a reliable,flow-controlled,and congestion-friendly,communication channel.If data packets corresponding to a file transfer are lost,then they are retransmitted.Furthermore,the file transfer does not overrun buffer resources at the receiver and adapts to the available bandwidth along the channel.Sockets of type SOCK_DGRAM use the UDP protocol for communicating data.The UDP protocol is more appropriate for checking whether another computer is up on the network.Since a connection-oriented communication channel is not required and since there might not be any active entities on the other side to establish a communication channel with,the UDP protocol is more appropriate.
Answer:Sockets of type SOCK STREAM use the TCP protocol for communicating data.The TCP protocol is appropriate for implementing an intercomputer file-transfer program since it provides a reliable,flow-controlled,and congestion-friendly,communication channel.If data packets corresponding to a file transfer are lost,then they are retransmitted.Furthermore,the file transfer does not overrun buffer resources at the receiver and adapts to the available bandwidth along the channel.Sockets of type SOCK_DGRAM use the UDP protocol for communicating data.The UDP protocol is more appropriate for checking whether another computer is up on the network.Since a connection-oriented communication channel is not required and since there might not be any active entities on the other side to establish a communication channel with,the UDP protocol is more appropriate.