swpchat.client
Class FileSendConnection
java.lang.Object
|
+--swpchat.client.ServerConnection
|
+--swpchat.client.FileConnection
|
+--swpchat.client.FileSendConnection
- All Implemented Interfaces:
- ChatTokens, ControlTokens, FileTransferTokens, ProtocolTokens, java.lang.Runnable, SenderReceiverTokens
- public class FileSendConnection
- extends FileConnection
- implements java.lang.Runnable, FileTransferTokens, ProtocolTokens
Class for sender communication to the server.
Fields inherited from interface swpchat.protocol.ChatTokens |
CHAR_ARG_SEP, CHAR_MSG_END, CHAR_MSG_EOL, CHAR_QUOTE, CHAR_STRING_DELIMITER, STR_ARG_SEP, STR_AUTHORIZE, STR_MSG_END, STR_MSG_EOL, STR_NEG_ARG, STR_NEGATIVE, STR_POS_ARG, STR_POSITIVE, STR_QUOTE, STR_REPLY, STR_STRING_DELIMITER, STR_WAIT |
Fields inherited from interface swpchat.protocol.SenderReceiverTokens |
STR_JOIN, STR_JOINPASSWD, STR_LEAVE, STR_OFF, STR_ON, STR_PLAY, STR_PLAY_BEGIN, STR_PLAY_RE_BEGIN, STR_RECEIVE, STR_RECEIVE_BEGIN, STR_RECEIVE_USERINFO, STR_REQUEST_USERINFO, STR_SEND, STR_SEND_BEGIN, STR_SEND_RE_BEGIN, STR_SETTOPIC, STR_SETTOPIC_BEGIN, STR_SHIP, STR_SHIP_BEGIN, STR_TOPICCHANGED, STR_WHISPER, STR_WHISPRECEIVE |
Fields inherited from interface swpchat.protocol.ControlTokens |
STR_EMOTION, STR_LOGIN, STR_LOGIN_BEGIN, STR_LOGIN_RE_BEGIN, STR_LOGOUT, STR_LOGOUT_BEGIN, STR_LOGOUT_RE_BEGIN, STR_MEMBER, STR_MEMBER_BEGIN, STR_MEMBER_INFO, STR_MEMBER_JOIN, STR_MEMBER_LEAVE, STR_MEMBER_SHIP, STR_NEW_CHANNEL, STR_NOTIFICATION, STR_NOTIFICATION_BEGIN, STR_NOTIFY_REQUEST, STR_REMOVE_CHANNEL, STR_RENAME_CHANNEL, STR_REQUEST_IP, STR_REQUST_IP_RE_BEGIN, STR_SEND_USERINFO, STR_SET_NICK, STR_SET_NICK_BEGIN, STR_SET_NICK_RE_BEGIN, STR_SET_SESSIONKEY, STR_STOP_NOTIFICATION, STR_TELEPHONE_REQUEST |
Method Summary |
void |
run()
|
void |
sendFile(java.lang.String IPadress,
java.io.File file)
Sends a file to the given client with the given IPAdress. |
private void |
writeFileToOutputStream()
|
Methods inherited from class swpchat.client.ServerConnection |
isEmotion, isEmotionReceive, isEmotionReply, isJoinReply, isLeaveReply, isLogoutReply, isMemberInfo, isNegativeRequestUserInfoReply, isNegativeSendUserInfoReply, isNewChannel, isNewChannelReply, isNotification, isPlay, isPlayReply, isPositiveRequestUserInfoReply, isPositiveSendUserInfoReply, isReceive, isReceiveUserInfo, isRemoveChannel, isRemoveChannelReply, isRenameChannel, isRenameChannelReply, isRequestIPAddress, isRequestIPAddressReply, isSendReply, isSendTelephoneRequest, isSendTelephoneRequestReply, isSetNickReply, isSetSessionKeyReply, isSetTopicReply, isShipReceive, isShipReply, isTopicChanged, isWhisperReply, isWhispreceive, readReply, reply, send, send, send, send, writeLine |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
CLS
static final java.lang.String CLS
socket
private java.net.Socket socket
oStream
private java.io.BufferedWriter oStream
objStream
private java.io.ObjectOutputStream objStream
tokenizer
private ChatStreamTokenizer tokenizer
tokenlist
private java.util.Vector tokenlist
inetAddress
private java.net.InetAddress inetAddress
clientControls
private ClientControls clientControls
IPadress
private java.lang.String IPadress
file
private java.io.File file
FileSendConnection
public FileSendConnection(ClientControls clientControls,
java.lang.String IPadress,
java.io.File file)
run
public void run()
- Specified by:
run
in interface java.lang.Runnable
writeFileToOutputStream
private void writeFileToOutputStream()
sendFile
public void sendFile(java.lang.String IPadress,
java.io.File file)
throws ServiceRefusedException,
TimeoutException,
java.io.IOException
- Sends a file to the given client with the given IPAdress.
- Parameters:
IPadress
- The IPadress of a Client, in a
notation accepted by Socket.Socket(String,int)
.file
- The file you want to send.- Throws:
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.