Tutorial #8

  1. What does the following line of Java code achieve when compiled and executed?

    Socket myclientsocket = new Socket("ironbark", 80);
  2. Assume you're writing a TCP (socket) based client/server application, using Java code similar to that given in the lecture. Why is important that the server program be started up (ie, executed) before the client program?

  3. How does the accept() socket method in Java indicate that a TCP connection has been established?

  4. The getInetAddress() and, to a lesser extent getPort(), methods are probably more useful for a socket in a server program than in a client. Why?

  5. What does it mean to say that the simple Java server program given in the lecture is single threaded? What is the disadvantage of a single-threaded server, and how is the alternative implemented? Can you think of any particular advantages of a single-threaded server?

  6. In the lecture it was claimed that the 4-tuple which identifies a TCP connection will always be unique. Suppose you have two telnet sessions running on your local desktop machine, both logged in to redgum. How are each of these connections uniquely identified?

  7. Suppose you were to run the example server program from the lecture on machine redgum, without changing the port number from 7277, as given there. Someone else has the same idea, and simultaneously runs a copy of the program on redgum. What will happen?

  8. In the "traditional" Unix/C implementation of sockets, a socket is first created, and then becomes either a client or server socket depending on subsequent operations performed on it -- eg, connect() for a client socket and bind() followed by accept() for a server. How does this compare with the Java approach?

  9. Look at the Perl socket client given in the lecture. What comments can you make on the code, compared to the Java implementation?

  10. In the lecture, it was mentioned that "lines-of-text"-based Internet application protocols such as HTTP introduce the need for parsing. What does this mean? What implications does it have for software implementations of these protocols? What are the advantages and disadvantages of this approach compared to other possible techniques?

La Trobe Uni Logo

Copyright 2004 by Philip Scott, La Trobe University.
Valid HTML 3.2!