|
SocketNet
1.0
A Socket Networking (C/S) Library
|
マルチスレッド TCP サーバ。 [詳解]


公開メンバ関数 | |
| TcpServer (int port, Packet packet) | |
| コンストラクタ。 [詳解] | |
| TcpServer (IPAddress ipAddress, int port, Packet packet) | |
| コンストラクタ。 [詳解] | |
| void | Dispose () |
| オブジェクトに関連付けられたリソースを解放します。 [詳解] | |
| async Task | Start () |
| TCPサーバをスタートします。 [詳解] | |
| void | Stop () |
| Tcpサーバを停止します。 [詳解] | |
| void | CloseConnection (TcpConnection connection) |
| アクティブな接続をクローズします。 [詳解] | |
静的公開変数類 | |
| static readonly int | MaxPendingConnections = 3 |
| ペンディングできる接続の最大数。 [詳解] | |
プロパティ | |
| IPAddress | IPAddress [get, private set] |
| Tcpサーバにバインドされている IP アドレスを取得します。 [詳解] | |
| int | Port [get, private set] |
| Tcpサーバにバインドされているポート番号を取得します。 [詳解] | |
| bool | IsRunning [get] |
| サーバの状態を取得します。 [詳解] | |
| int | ActiveConnectionCount [get] |
| アクティブな接続の数を取得します。 [詳解] | |
| ReadOnlyCollection< TcpConnection > | ActiveConnections [get] |
| アクティブな接続のリストを取得します。 [詳解] | |
イベント | |
| EventHandler< TcpConnectionEventArgs > | Connected |
| 接続が確立した時に発行されます。 [詳解] | |
| EventHandler< TcpConnectionEventArgs > | Disconnected |
| 接続が切断された時に発行されます。 [詳解] | |
| EventHandler< TcpDataReceivedEventArgs > | DataReceived |
| データを受信した時に発行されます。 [詳解] | |
非公開メンバ関数 | |
| void | Dispose (bool disposing) |
| オブジェクトに関連付けられたリソースを解放します。 [詳解] | |
| void | OnConnected (TcpConnectionEventArgs e) |
| 接続イベントを発行します。 [詳解] | |
| void | OnDisconnected (object sender, TcpConnectionEventArgs e) |
| 切断イベントを発行します。 [詳解] | |
| void | OnDataReceived (object sender, TcpDataReceivedEventArgs e) |
| データ受信イベントを発行します。 [詳解] | |
| void | CloseMarkedConnections () |
| マークされた接続をクローズします。 [詳解] | |
非公開変数類 | |
| readonly Packet | Packet |
| TcpListener | tcpListener |
| List< TcpConnection > | clientConnections |
| List< TcpConnection > | connectionsToClose |
| volatile bool | isShuttingDown |
| volatile bool | acceptingConnections |
| bool | disposed = false |
マルチスレッド TCP サーバ。
このサーバは、TCPメッセージを非同期的に受信します。 Start メソッドで待ち受けを開始します。 接続が確立すると Connected イベントが発行されます。 接続が切断されると Disconnected イベントが発行されます。 メッセージを完全に受信すると DataReceived イベントが発行されます。
受信するメッセージについては TcpConnection クラスの説明を参照してください。
| SocketNet.TcpServer.TcpServer | ( | int | port, |
| Packet | packet | ||
| ) |
コンストラクタ。
| port | バインドするポート。 |
| packet | 受信するパケットの各部の長さの設定を格納するオブジェクト。 |
ループバックアドレスを使用します。
コンストラクタ。
| ipAddress | バインドするIPアドレス。 |
| port | バインドするポート。 |
| packet | 受信するパケットの各部の長さの設定を格納するオブジェクト。 |
参照先 SocketNet.TcpServer.IPAddress, SocketNet.TcpServer.Port.
| void SocketNet.TcpServer.CloseConnection | ( | TcpConnection | connection | ) |
アクティブな接続をクローズします。
| connection | クローズする接続。 |
参照先 SocketNet.TcpConnection.Dispose().
参照元 SocketNet.TcpServer.CloseMarkedConnections(), SocketNet.TcpServer.OnDisconnected().


|
private |
マークされた接続をクローズします。
参照先 SocketNet.TcpServer.CloseConnection().
参照元 SocketNet.TcpServer.Start().


| void SocketNet.TcpServer.Dispose | ( | ) |
オブジェクトに関連付けられたリソースを解放します。
|
private |
オブジェクトに関連付けられたリソースを解放します。
| disposing |
参照先 SocketNet.TcpConnection.Dispose(), SocketNet.TcpServer.Stop().

|
private |
接続イベントを発行します。
| e | イベントデータを格納した TcpConnectionEventArgs オブジェクト。 |
参照先 SocketNet.TcpServer.Connected.
参照元 SocketNet.TcpServer.Start().

|
private |
データ受信イベントを発行します。
| sender | センダ。 |
| e | イベントデータを格納する TcpDataReceivedEventArgs オブジェクト。 |
参照先 SocketNet.TcpServer.DataReceived.
参照元 SocketNet.TcpServer.Start().

|
private |
切断イベントを発行します。
| sender | センダ。 |
| e | イベントデータを格納する TcpConnectionEventArgs オブジェクト。 |
参照先 SocketNet.TcpServer.CloseConnection(), SocketNet.TcpConnectionEventArgs.Connection, SocketNet.TcpServer.Disconnected.
参照元 SocketNet.TcpServer.Start().


| async Task SocketNet.TcpServer.Start | ( | ) |
TCPサーバをスタートします。
非同期で呼び出します。
参照先 SocketNet.TcpServer.CloseMarkedConnections(), SocketNet.TcpConnection.DataReceived, SocketNet.TcpConnection.Disconnected, SocketNet.TcpServer.IPAddress, SocketNet.TcpServer.OnConnected(), SocketNet.TcpServer.OnDataReceived(), SocketNet.TcpServer.OnDisconnected(), SocketNet.TcpServer.Port, SocketNet.TcpConnection.ReceiveDataAsync().
参照元 SampleChatServer.ChatServer.Start().


| void SocketNet.TcpServer.Stop | ( | ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
static |
ペンディングできる接続の最大数。
|
private |
|
private |
|
get |
アクティブな接続の数を取得します。
|
get |
アクティブな接続のリストを取得します。
|
getprivate set |
Tcpサーバにバインドされている IP アドレスを取得します。
参照元 SocketNet.TcpServer.Start(), SocketNet.TcpServer.TcpServer().
|
get |
サーバの状態を取得します。
|
getprivate set |
Tcpサーバにバインドされているポート番号を取得します。
参照元 SocketNet.TcpServer.Start(), SocketNet.TcpServer.TcpServer().
| EventHandler<TcpConnectionEventArgs> SocketNet.TcpServer.Connected |
接続が確立した時に発行されます。
参照元 SampleChatServer.ChatServer.ChatServer(), SocketNet.TcpServer.OnConnected().
| EventHandler<TcpDataReceivedEventArgs> SocketNet.TcpServer.DataReceived |
データを受信した時に発行されます。
参照元 SampleChatServer.ChatServer.ChatServer(), SocketNet.TcpServer.OnDataReceived().
| EventHandler<TcpConnectionEventArgs> SocketNet.TcpServer.Disconnected |
接続が切断された時に発行されます。
参照元 SampleChatServer.ChatServer.ChatServer(), SocketNet.TcpServer.OnDisconnected().