Network programming
Questions
- Explain
the following concepts: server, client, internet address, port and socket.
- Write
a short program to get the IP 24524x231y address of the local host.
- What
is a stream? Explain and give a short example (java code) of working with
sockets as stream.
- Write
a small server that listens on a port supplied as a parameter in the
command line, and exits once a client connects.
- How
can you threat multiple clients in a Socket based distributed application?
- What
is the difference between TCP and UDP? Give examples of when to use TCP
and when UDP. Name java classes that we must use in order to work with
TCP, respectively with UDP.
Problems
- Write
a simple distributed application with a server and a single client that
sends lines of text (from the user input) to the server, and the server
returns the reversed line back to the client (where it must be displayed).
- Write
a distributed application with a server and multiple clients that
implements the following communication protocol:
Client: "ping"
Server: "pong"
Client: "who's there?"
Server: "I am the server"
Server: "who are you?"
Client: "I am the client"
- Write
a chat program that supports multiple clients (all clients can see all
messages).
- Write
an application that allows remote computers to get the atomic time from a
time server. Bonus: implement a mechanism to determine the delays in the
network.
RMI
Questions
- Which
is the basic principal difference between the RPC (Remote Procedure Call)
and RMI?
- Which
is the difference between the methods Naming.bind
and Naming.rebind?
- It is
possible to start programmatically the registry? If yes, which is the
difference between starting it manually and starting it programmatically?
- If the
client of a RMI object is on another machine then where the object runs,
the stub and skeleton codes where will run?
- What
is wrong in the next remote interface definition:
public
interface PerfectTimeI extends Remote ///:~
Problems
- Write
a code snippet for a client side lookup of an arbitrary remote interface.
- Write
the remote interface and the implementation class for a remote object
which provides the possibility to authorize a user using and id and
password, also provide the registration code of the remote object. The authorization
should succeed always for simplicity.
JDBC
Questions
- What
does the JDBC database URL specify?
- Please describe the necessary steps to
be done in order to execute and process a SQL query in java.
- Enumerate some advantages of the JDBC
technology?
- Which are the difference between
JDBC-ODBC and JDBC driver?
- Please describe the role of
connection-pooling.
- Please enumerate some advantages and
disadvantages of the PrepareStatement.
- What is the difference between
Statement and CallableStatement?
- Explain when should we use each of the
following methods of Statement interface:
- executeUpdate
- executeQuery
- executeBatch
Problems
- Create a
class that opens a connection to a database using JDBC_ODBC bridge.
- Write a
java class that inserts into a database table (let say Users[FirstName,LastName,Email]) n records using PreparedStatement interface.
- For a database with the following
structure, write a class that displays all students for a given department
of a university.
- Write a class which opens a JDBC-ODBC
connection to a given data base, read all records of a table (Persons[name, address, email, age]) and display them
ordered by name.
- Suppose that we have 2 tables with the
same structure within a given database. Write a java class that allows you
to copy all data from one table to other. Table should be given as
execution arguments.
Table structure:
o id: int
o name: varchar
o price: int