3
CS 742 Computer Communication Networks - Homework 1 - Name:____________ Assigned: Monday, September 8 Due: Monday, September 15 (in class) o Please show all work on a separate sheet attached to this sheet. (40 points - 5 points for each problem) 1. Imagine that you have trained your St. Bernard, Bernie, to carry a box of three 8mm tapes instead of a flask of brandy. These tapes each contain 7 GBs. The dog can travel at a rate of 18 km/hr. For what range of distances does Bernie have a higher data rate than 150 Mbps? Ans: The dog can carry 21 gigabytes, or 168 gigabits. A speed of 18 km/hour equals 0.005 km/sec. The time to travel distance x km is x / 0.005 = 200x sec, yielding a data rate of 168/200x 2^30 bps or 901.9431322/x Mbps if G is defined as 2^30. For x < 6.01 km, the dog has a higher rate than the communication line. But G is defined as 10^9 in most commercial products. Then the data rate is 168/200x 10^9 bps or 840/x Mbps. For x < 5.6 km, the dog has a higher rate than the communication line. 2. What is the principal difference between connectionless communication and connection-oriented communication? Give an example of unreliable connection-oriented service. Give an example of reliable connectionless service. In which cases unreliable communication is used? Ans: 1) Connectionoriented communication has three phases. In the establishment phase a request is made to set up a connection. Only after this phase has been successfully completed can the data transfer phase be started and data trans ported. Then comes the release phase. Connectionless communication does not have these phases. It just sends the data. 2) Unreliable connection-oriented service: digitized voice Reliable connectionless service: registered mail when the packages can be received as the order sent 3) a. Reliable communication is not available. b. The delay in a reliable service might not be acceptable such as real-time applications. 3. The well-known port numbers are contained in the file /etc/services on most Unix systems. Determine the port number and protocol used by the following servers: a. Mail: b. FTP: c. Time: Why is it important for all "HTTP" servers to be assigned to the

CS 742 Computer Communication Networks

Embed Size (px)

Citation preview

Page 1: CS 742 Computer Communication Networks

 

CS 742 Computer Communication Networks - Homework 1 - Name:____________

Assigned: Monday, September 8Due: Monday, September 15 (in class)

o Please show all work on a separate sheet attached to this sheet.

(40 points - 5 points for each problem)

1. Imagine that you have trained your St. Bernard, Bernie, to carrya box of three 8mm tapes instead of a flask of brandy. Thesetapes each contain 7 GBs. The dog can travel at a rate of 18 km/hr.For what range of distances does Bernie have a higher data ratethan 150 Mbps?

Ans: The dog can carry 21 gigabytes, or 168 gigabits. A speed of18 km/hour equals 0.005 km/sec. The time to traveldistance x km is x / 0.005 = 200x sec, yielding a data rateof 168/200x 2^30 bps or 901.9431322/x Mbps if G is defined as2^30.

For x < 6.01 km, the dog has a higher rate than the communicationline.

But G is defined as 10^9 in most commercial products. Thenthe data rate is 168/200x 10^9 bps or 840/x Mbps.

For x < 5.6 km, the dog has a higher rate than the communicationline.

2. What is the principal difference between connectionlesscommunication and connection-oriented communication? Givean example of unreliable connection-oriented service. Givean example of reliable connectionless service. In which casesunreliable communication is used?

Ans: 1) Connectionoriented communication has three phases. In theestablishment phase a request is made to set up a connection.Only after this phase has been successfully completed can thedata transfer phase be started and data trans ported. Thencomes the release phase. Connectionless communication doesnot have these phases. It just sends the data.

2) Unreliable connection-oriented service: digitized voiceReliable connectionless service: registered mail when thepackages can be received as the order sent

3) a. Reliable communication is not available.b. The delay in a reliable service might not be acceptable

such as real-time applications.

3. The well-known port numbers are contained in the file/etc/services on most Unix systems. Determine theport number and protocol used by the following servers:

a. Mail: b. FTP: c. Time:

Why is it important for all "HTTP" servers to be assigned to the

Page 2: CS 742 Computer Communication Networks

 

same port? (5 points)

Ans: 1) a. Mail: 25 b. FTP: 21 c. Time: 372) A known port will allow all client programs to access the same

service through the same port on different machines.

4. Name 7 layers in the OSI Reference Model. Find a protocol for eachlayer, respectively.

Ans: Application layer - FTP, HTTP, SMTP, SSHPresentation layer - ASN.1, NDR, XDRSession layer - WSPTransport layer - UDP, TCPNetwork layer - IPDatalink layer - HDLC, PPPPhysical layer - Ethernet, ISDN

5. List two ways in which the OSI reference model and the TCP/IPreference model are the same. Now list two ways in which theydiffer.

Ans: Both models are based on layered protocols. Both have a network,transport, and application layer. In both models, the transportservice can provide a reliable endtoend byte stream.On the other hand, they differ in several ways. The number oflayers is different, the TCP/IP does not have session orpresentation layers, OSI does not support internetworking, andOSI has both connectionoriented and connectionless service inthe network layer.

6. An image is 1024 x 768 pixels with 3 bytes/pixel. Assume theimage is uncompressed. How long does it take to transmit itover a 56-kbps modem channel? Over a 1-Mbps cable modem?Over a 10-Mbps Ethernet? Over 100-Mbps Ethernet?

Ans: The image is 1024 x 768 x 3 bytes or 2,359,296 bytes. This is18,874,368 bits. At 56,000 bits/sec, it takes about 337.042 sec.At 1,000,000 bits/sec, it takes about 18.874 sec. At10,000,000 bits/sec, it takes about 1.887 sec. At100,000,000 bits/sec, it takes about 0.189 sec.

7. Write a program that reads in an integer, n, and computes the sumof the first n positive integers. Hint: Write a program of theform

public class Sum {public static void main(String[] args) {

...System.out.println( );...

}}

Ans: public class Sum {public static void main(String[] args) {

int sum = 0;for (int i = Integer.parseInt(args[0]); i > 0; i--)

Page 3: CS 742 Computer Communication Networks

 

sum += i;System.out.println("sum = " + sum);

}}

orimport java.io.*;public class Tol {private static BufferedReader stdin =new BufferedReader(new InputStreamReader(System.in));

public static void main(String[] args) throws IOException {System.out.print("n = ");int n = Integer.parseInt(stdin.readLine());int sum = 0;for (int i = 1; i <= n; i++) sum += i;System.out.println("sum = " + sum);

}}

8. Use Java to create a BankAccount class. It should containits constructor, balance, deposit, and withdraw methods.

Ans: public class BankAccount {private double balance = 0;BankAccount(double bal) {balance = bal;);public void balance () {return balance;};public void deposit (double amount) {balance += amount;};double withdraw (double amount) {balance -= amount;}

}