SocketNet  1.0
A Socket Networking (C/S) Library
SampleChatClient.ChatClient クラス

SocketNet ライブラリのサンプルプログラム (簡単なチャットクライアント)。 [詳解]

SampleChatClient.ChatClient 連携図
Collaboration graph

公開メンバ関数

 ChatClient ()
 コンストラクタ。 [詳解]
 
 ChatClient (TcpConnection connection)
 コンストラクタ。 [詳解]
 
 ChatClient (IPEndPoint serverEndPoint)
 コンストラクタ。 [詳解]
 
 ChatClient (IPAddress serverIPAddress, int serverPort)
 コンストラクタ。 [詳解]
 
void Connect ()
 サーバに接続します。 [詳解]
 
void Connect (IPEndPoint serverEndPoint)
 指定されたエンドポイントのサーバに接続します。 [詳解]
 
void Connect (IPAddress serverIPAddress, int serverPort)
 指定されたIPアドレスとポート番号のサーバに接続します。 [詳解]
 
void Close ()
 接続を閉じます。 [詳解]
 
void BeginReceiveMessage ()
 メッセージの受信を開始します。 [詳解]
 
void Send (ChatMessage message)
 指定されたチャットメッセージを送信します。 [詳解]
 

プロパティ

IPAddress RemoteIPAddress [get, private set]
 接続先のIPアドレスを取得します。 [詳解]
 
int RemotePort [get, private set]
 接続先のポート番号を取得します。 [詳解]
 
TcpConnection Connection [get, private set]
 接続を取得します。 [詳解]
 
bool IsConnected [get]
 接続しているかどうかを取得します。 [詳解]
 

イベント

EventHandler< ChatMessageReceivedEventArgsChatMessageReceived
 チャットメッセージを受信した時に発行されます。 [詳解]
 

非公開メンバ関数

void OnDataReceived (object sender, TcpDataReceivedEventArgs e)
 Tcpパケットを受信したときにチャットメッセージに変換して、メッセージ受信イベントを発行します。 [詳解]
 

詳解

SocketNet ライブラリのサンプルプログラム (簡単なチャットクライアント)。

構築子と解体子

SampleChatClient.ChatClient.ChatClient ( )

コンストラクタ。

SampleChatClient.ChatClient.ChatClient ( TcpConnection  connection)

コンストラクタ。

引数
connection接続。

参照先 SampleChatClient.ChatClient.Connection.

SampleChatClient.ChatClient.ChatClient ( IPEndPoint  serverEndPoint)

コンストラクタ。

引数
serverEndPointサーバのエンドポイント。
SampleChatClient.ChatClient.ChatClient ( IPAddress  serverIPAddress,
int  serverPort 
)

コンストラクタ。

引数
serverIPAddressサーバのIPアドレス。
serverPortサーバのポート番号。

参照先 SampleChatClient.ChatClient.RemoteIPAddress, SampleChatClient.ChatClient.RemotePort.

メソッド詳解

void SampleChatClient.ChatClient.BeginReceiveMessage ( )

メッセージの受信を開始します。

参照先 SampleChatClient.ChatClient.Connection, SocketNet.TcpConnection.ReceiveDataAsync().

参照元 MainWindow.OnConnectButtonClicked().

呼び出し関係図:

被呼び出し関係図:

void SampleChatClient.ChatClient.Close ( )

接続を閉じます。

参照先 SampleChatClient.ChatClient.Connection, SocketNet.TcpConnection.Dispose().

参照元 MainWindow.OnDisconnectButtonClicked().

呼び出し関係図:

被呼び出し関係図:

void SampleChatClient.ChatClient.Connect ( )
void SampleChatClient.ChatClient.Connect ( IPEndPoint  serverEndPoint)

指定されたエンドポイントのサーバに接続します。

引数
serverEndPointサーバのエンドポイント。

参照先 SampleChatClient.ChatClient.Connect().

呼び出し関係図:

void SampleChatClient.ChatClient.Connect ( IPAddress  serverIPAddress,
int  serverPort 
)

指定されたIPアドレスとポート番号のサーバに接続します。

引数
serverIPAddressサーバのIPアドレス。
serverPortサーバのポート番号。

参照先 SampleChatClient.ChatClient.Connection, SocketNet.TcpConnection.DataReceived, SampleChatClient.ChatClient.OnDataReceived(), SampleChatClient.ChatClient.RemoteIPAddress, SampleChatClient.ChatClient.RemotePort.

呼び出し関係図:

void SampleChatClient.ChatClient.OnDataReceived ( object  sender,
TcpDataReceivedEventArgs  e 
)
private

Tcpパケットを受信したときにチャットメッセージに変換して、メッセージ受信イベントを発行します。

引数
senderセンダ。
eイベントデータを格納するオブジェクト。

参照先 SampleChatClient.ChatClient.ChatMessageReceived, SocketNet.TcpDataReceivedEventArgs.Connection, SampleChatClient.ChatMessage.Connection, SocketNet.TcpDataReceivedEventArgs.Data, SampleChatClient.ChatMessage.FromByteArray().

参照元 SampleChatClient.ChatClient.Connect().

呼び出し関係図:

被呼び出し関係図:

void SampleChatClient.ChatClient.Send ( ChatMessage  message)

指定されたチャットメッセージを送信します。

引数
messageメッセージ。

参照先 SampleChatClient.ChatClient.Connection, SampleChatClient.ChatMessage.ToByteArray(), SocketNet.TcpConnection.Writer.

参照元 MainWindow.OnSendButtonClicked().

呼び出し関係図:

被呼び出し関係図:

プロパティ詳解

bool SampleChatClient.ChatClient.IsConnected
get

接続しているかどうかを取得します。

IPAddress SampleChatClient.ChatClient.RemoteIPAddress
getprivate set

接続先のIPアドレスを取得します。

The remote IP address.

参照元 SampleChatClient.ChatClient.ChatClient(), SampleChatClient.ChatClient.Connect().

int SampleChatClient.ChatClient.RemotePort
getprivate set

接続先のポート番号を取得します。

The remote port.

参照元 SampleChatClient.ChatClient.ChatClient(), SampleChatClient.ChatClient.Connect().

イベント詳解

EventHandler<ChatMessageReceivedEventArgs> SampleChatClient.ChatClient.ChatMessageReceived

チャットメッセージを受信した時に発行されます。

参照元 MainWindow.OnConnectButtonClicked(), SampleChatClient.ChatClient.OnDataReceived().


このクラス詳解は次のファイルから抽出されました: