Homework for the lecture “TCP/IP Programming in Java”

advertisement
Exam for the lecture “TCP/IP Programming in Java”
1- Name two reasons why there is no Chat system programmed with multicasting
1-
2-
2- For the servers described (a, b, c, d) explain which characteristics (1, 2, 3) should they have.
Explain the reasons you have considered for giving your answers
1) Connection oriented or connectionless communication with the client ?
2) Iterative or concurrent ?
3) With state or without state ?
a) A fileserver
b) A timestamp server
c) A video server
3- Explain how would you modify the TCP/IP based Chat server and client you saw during the
lectures in order to have at the client a list of the nicknames of the participants always updated,
even if the client program crashes
4- We want to have a server which stores the IP addresses of machines offering certain services
(for example, timestamp server, file server, etc.) the port numbers at which the service can be
contacted and the name of the service. The clients requiring a certain service can contact this
server and ask for the communication parameters for a certain service. Describe how would you
program this server. Especially describe how would you implement: a) the registering of the
services given by other computers and b) giving the information about the registered services to
other client computers
5- The next program shows a server. Answer the following questions about this server:
ServerSocket srv = new ServerSocket(4444);
While (true) {
Socket s = srv.accept();
BufferedReader in = new BufferedReader( new
InputStreamReader(s.getInputStream());
BufferedReader inf = new BufferedReader( new
FileReader(in.readLine());
PrintWriter out = new PrintWriter(in.getOutputStream(),true);
Out.println(inf.readLine());
}
1- How would you write a client program for contacting this server ? (use Java or a pseudo
programming language)
2- Name 2 actions a client can take in order to crash this server
Download