Lecture 3 Flashcards
Which ports are reserved for standard protocols?
0-1023
What commands are supported by HTTP?
GET, POST, PUT, DELETE, HEAD, OPTIONS, TRACE
What is POP? What’s its port? What commands?
Post Office Protocol
Port 110
USER, PASS, STAT, RETR, DELE, QUIT
How is input/output done in java with sockets
Input/output streams
How is a socket constructed in java?
Socket s = new Socket(hostname, portnumber);
What does the accept() methofd do on a ServerSocket?
Block the thread until a client connects, and when it does, return a Socket object representing that client’s socket.
How do you get the input and output streams of a socket?
InputStream in = s.getInputStream();
OutputStream out = s.getOutputStream();
What ae object streams?
ObjectInputStream/ObjectOutputStream
Automatically serialises serialisable objects and sends them over the stream, before being deserialised on the other end
How does RMI work?
Client calls method on client side proxy
Client side proxy packages the info and sends it via network to the serer side proxy
server side proxy depackages it, makes a call to the local (server) method, and packages the return info up -> sends back to client
client side proxy unpackages the result and gives it to the client
What does the RMI program deal with locally?
stubs that implement the interface Remote
RMI calls are asynchronous
T or F
F - they are synchronous (blocking)
What 5 steps are involved in creating a RMI server?
Define remote interface
Write a remote implementation
Start the RMI registry
Create the remote service
Register the service with the registry
What does a remote interface contain?
What constraints are on the methods?
Stub methods that can be implemented on the server
Must declare RemoteException, return values must be primitive or serialisable
What is the easiest way to create a RMI server
Extend java.rmi.server.UnicastRemoteObject
Add constructor that can throw RemoteException
Register the service (usually in static main() method)
what is an RMI registry?
Service that registers/looks up RMI server objects