Subjects ->
Computer Networks ->
Lectures ->
Lecture #09
INT20CN Computer Networks
Tutorial #9
- 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?
- How does the
accept()
socket method in Java
indicate that a TCP connection has been established?
- 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?
- 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?
- 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
ironbark
. How are
each of these connections uniquely identified?
- Suppose you were to run the example server program from the lecture on machine ironbark, 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 ironbark. What will happen?
- 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?
- Look at the Perl socket client given in the lecture. What comments
can you make on the code, compared to the Java implementation?
These tutorial exercises accompany
Lecture #9.
See Prac #9 for the practical exercises
accompanying this tutorial.
[Previous Tutorial]
[Index]
[Next Tutorial]
Copyright © 2001 by
Philip Scott,
La Trobe University.