|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This interface defines the API to the Chat protocol on the client side. Classes implementing this interface may map them to Input/Output streams, remote procedure calls or the likes.
If the Server response is unparseable or otherwise garbled, a
ProtocolException
should be
thrown.
Method Summary | |
void |
connect(java.lang.String servername,
java.lang.String sessionKey)
Connects to the given server with the given nickname. |
void |
disconnect()
Disconnect from the server. |
boolean |
isConnected()
Checks wether the client is connected. |
void |
join(java.lang.String sessionKey,
java.lang.String channelName)
join specified channel |
void |
leave(java.lang.String channelName)
leave the specified channel |
void |
play(java.lang.String channelName,
java.lang.String audiokey)
Make other clients play a sound file. |
void |
send(java.lang.String channelName,
java.lang.String text)
Send media to the server. |
Method Detail |
public void connect(java.lang.String servername, java.lang.String sessionKey) throws ServiceRefusedException, TimeoutException, java.io.IOException
servername
- The name of a spChatServer host, in a
notation accepted by Socket.Socket(String,int)
.nickname
- The desired nickname.ServiceRefusedException
- If the server rejected
logging in. Generally not being able to open the socket
produces some java.net exception.TimeoutException
- If the Server did not react within a
certain timeout.java.io.IOException
- For problems in lower layers.public void join(java.lang.String sessionKey, java.lang.String channelName) throws ServiceRefusedException, TimeoutException, NotConnectedException, java.io.IOException
sessionKey
- that identifies the clientString
- the Channel to joinpublic void leave(java.lang.String channelName) throws ServiceRefusedException, TimeoutException, NotConnectedException, java.io.IOException
strChannel
- the channel to leftpublic void send(java.lang.String channelName, java.lang.String text) throws ServiceRefusedException, NotConnectedException, TimeoutException, java.io.IOException
ServiceRefusedException
- If the server rejected
the send request.NotConnectedException
- The client is not connected to
the server.TimeoutException
- If the server does not send the
receipt within a certain timeout.java.io.IOException
- For problems in lower layers.public void play(java.lang.String channelName, java.lang.String audiokey) throws ServiceRefusedException, NotConnectedException, TimeoutException, java.io.IOException
audiokey
- The name of the sound to play. The receiving
clients maps this name to a sound file and
plays that file. Default names include
Hello
plays a greeting,
Laugh
plays a laugh and
Bye
.ServiceRefusedException
- If the server rejected
the play request.NotConnectedException
- The client is not connected to
the server.TimeoutException
- If the server does not send the
receipt within a certain timeout.java.io.IOException
- For problems in lower layers.public void disconnect() throws ServiceRefusedException, NotConnectedException, TimeoutException, java.io.IOException
NotConnectedException
- If the client has not been
connected in the first place.java.io.IOException
- For problems in lower layers. The
client is disconnected nonetheless.public boolean isConnected()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |