jp.ac.fun.osawalab.tileworld.connector
クラス SocketThread

java.lang.Object
  上位を拡張 java.lang.Thread
      上位を拡張 jp.ac.fun.osawalab.tileworld.connector.ConnectorThread
          上位を拡張 jp.ac.fun.osawalab.tileworld.connector.SocketThread
すべての実装されたインタフェース:
Runnable

public final class SocketThread
extends ConnectorThread

サーバーへの接続を管理している ConnectorThread のSocketによる実装クラスです。

作成者:
高山 貴裕(公立はこだて未来大学 システム情報科学研究科 大沢研究室)
関連項目:
Connector

入れ子のクラスの概要
 
クラス java.lang.Thread から継承された入れ子のクラス/インタフェース
Thread.State, Thread.UncaughtExceptionHandler
 
フィールドの概要
 
クラス java.lang.Thread から継承されたフィールド
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
コンストラクタの概要
SocketThread(Socket socket)
          コンストラクタです。
 
メソッドの概要
 void exit()
          ログアウト処理を行います。
protected  String receiveQuery()
          ソケットから、クライアントから要求コマンドを受け取ります。
 void sendMessage(String message)
          ソケットをもちいてクライアントにメッセージを送信します。
 void sendReply(String message)
          ソケットをもちいてクライアントの要求コマンドに対する応答を返信します。
 void setConnector(Connector connector)
          このスレッドが管理する接続を設定します。
 
クラス jp.ac.fun.osawalab.tileworld.connector.ConnectorThread から継承されたメソッド
getConnector, run
 
クラス java.lang.Thread から継承されたメソッド
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

コンストラクタの詳細

SocketThread

public SocketThread(Socket socket)
コンストラクタです。接続されたクライアントソケットから、 入出力ストリームを開きます。また、メッセージ送信用の DatagramSocketも初期化します。

パラメータ:
socket - クライアントソケット。
メソッドの詳細

exit

public void exit()
ログアウト処理を行います。ソケット、入出力ストリームをクローズします。 接続を破棄し、スレッドを終了させます。

オーバーライド:
クラス ConnectorThread 内の exit
関連項目:
jp.ac.fun.osawalab.tileworld.connector.ConnectorThread#logout()

sendMessage

public void sendMessage(String message)
ソケットをもちいてクライアントにメッセージを送信します。

定義:
クラス ConnectorThread 内の sendMessage
パラメータ:
message - 送信するメッセージ。
関連項目:
ConnectorThread.sendMessage(java.lang.String)

sendReply

public void sendReply(String message)
ソケットをもちいてクライアントの要求コマンドに対する応答を返信します。

定義:
クラス ConnectorThread 内の sendReply
パラメータ:
message - コマンドに対する応答。
関連項目:
ConnectorThread.sendReply(java.lang.String)

setConnector

public void setConnector(Connector connector)
クラス ConnectorThread の記述:
このスレッドが管理する接続を設定します。

オーバーライド:
クラス ConnectorThread 内の setConnector
パラメータ:
connector - 管理する接続。

receiveQuery

protected String receiveQuery()
ソケットから、クライアントから要求コマンドを受け取ります。

定義:
クラス ConnectorThread 内の receiveQuery
戻り値:
取得した要求コマンド。
関連項目:
ConnectorThread.receiveQuery()