Give an outline of the server implementation showing how the operations getRequest and sendReply are used by a server that creates a new thread to execute each client request. Indicate how the server will copy the requestId from the request message into the reply message and how it will obtain the client IP address and port..
What will be an ideal response?
```
class Server{
private int serverPort = 8888;
public static int messageLength = 1000; DatagramSocket mySocket;
public Server(){
mySocket = new DatagramSocket(serverPort);
while(true){
byte [] request = getRequest(); Worker w = new Worker(request);
}
}
public byte [] getRequest(){
//as above}
public void sendReply(byte[]reply, InetAddress clientHost, int clientPort){
// as above}
}
class Worker extends Thread { InetAddress clientHost;
int clientPort; int requestId; byte [] request;
public Worker(request){
// extract fields of message into instance variables
}
public void run(){
try{
req = request.unmarshal();
byte [] args = req.getArgs();
//unmarshall args, execute operation,
// get results marshalled as array of bytes in result RequestMessage rm = new RequestMessage( requestId, result); reply = rm.marshal();
sendReply(reply, clientHost, clientPort );
}catch {... }
}
}
```
You might also like to view...
Referring to the picture above, what is the maximum number of slides per page?
A. 4 B. 6 C. 9 D. 12
A bug is a flaw in programming of a software application
Indicate whether the statement is true or false
When a manual adjustment is made to an individual text, Word will automatically update all the other texts with the same style
Indicate whether the statement is true or false
The WHERE clause applies to both rows and groups.
Answer the following statement true (T) or false (F)