|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectnet.zortrium.p2proto.MsgResponder
public class MsgResponder
Class to facilitate sending a response message to a host who previously sent the local host a query message. The response message will be automatically handled as a response to the query message once it reaches the other host. Note that only one message can be sent as a response per request message. Additionally, responses may only be sent if the sender requested a response when sending the message.
| Method Summary | |
|---|---|
InetAddress |
getPeerAddress()
Get the address of the peer from which the request message was received. |
boolean |
responseRequested()
Get whether a response was requested by the sender. |
void |
sendError(String error)
Convenience method that simply calls sendError(String, Msg) with
no content message. |
void |
sendError(String error,
Msg msg)
Send an error message to the other host that will raise an exception. |
void |
sendResponse(Msg msg)
Send a message to the other host that will be associated as a response to the query message. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public InetAddress getPeerAddress()
public boolean responseRequested()
public void sendResponse(Msg msg)
throws IOException
IllegalStateException. If no response was requested (as given by
responseRequested()), calling this method will also throw an
IllegalStateException.
msg - The response message to send.
IOException - If an error occurs while sending the message.
IllegalStateException - If a response or error has already been sent.
public void sendError(String error,
Msg msg)
throws IOException
IllegalStateException.
error - A textual description of the error.msg - A message to be sent with the error (may be null).
IOException - If a send error occurs.
IllegalStateException - If a response or error has already been sent.
public void sendError(String error)
throws IOException
sendError(String, Msg) with
no content message.
error - A textual description of the error.
IOException - If a send error occurs.
IllegalStateException - If a response or error has already been sent.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||