C# Класс Dazzle.Server.AsyncTcpServer

An Asynchronous TCP Server that makes use of system managed threads and callbacks to stop the server ever locking up.
Показать файл Открыть проект

Открытые методы

Метод Описание
AsyncTcpServer ( IPAddress localaddr, int port ) : System

Constructor for a new server using an IPAddress and Port

AsyncTcpServer ( IPEndPoint localEP ) : System

Constructor for a new server using an end point

Start ( ) : void

Starts the TCP Server listening for new clients.

Stop ( ) : void

Stops the TCP Server listening for new clients and disconnects any currently connected clients.

Write ( TcpClient tcpClient, byte bytes ) : void

Writes a byte array to a given TCP Client

Write ( TcpClient tcpClient, string data ) : void

Writes a string to a given TCP Client

Write ( byte bytes ) : void

Writes a byte array to all clients connected.

Write ( string data ) : void

Writes a string to all clients connected.

Защищенные методы

Метод Описание
HandleData ( byte data, TcpClient client ) : void

Приватные методы

Метод Описание
AcceptTcpClientCallback ( IAsyncResult result ) : void

Callback for the accept tcp client opertaion.

AsyncTcpServer ( ) : System

Private constructor for the common constructor operations.

ReadCallback ( IAsyncResult result ) : void

Callback for the read opertaion.

WriteCallback ( IAsyncResult result ) : void

Callback for the write opertaion.

Описание методов

AsyncTcpServer() публичный Метод

Constructor for a new server using an IPAddress and Port
public AsyncTcpServer ( IPAddress localaddr, int port ) : System
localaddr System.Net.IPAddress The Local IP Address for the server.
port int The port for the server.
Результат System

AsyncTcpServer() публичный Метод

Constructor for a new server using an end point
public AsyncTcpServer ( IPEndPoint localEP ) : System
localEP System.Net.IPEndPoint The local end point for the server.
Результат System

HandleData() защищенный Метод

protected HandleData ( byte data, TcpClient client ) : void
data byte
client System.Net.Sockets.TcpClient
Результат void

Start() публичный Метод

Starts the TCP Server listening for new clients.
public Start ( ) : void
Результат void

Stop() публичный Метод

Stops the TCP Server listening for new clients and disconnects any currently connected clients.
public Stop ( ) : void
Результат void

Write() публичный Метод

Writes a byte array to a given TCP Client
public Write ( TcpClient tcpClient, byte bytes ) : void
tcpClient System.Net.Sockets.TcpClient The client to write to
bytes byte The bytes to send
Результат void

Write() публичный Метод

Writes a string to a given TCP Client
public Write ( TcpClient tcpClient, string data ) : void
tcpClient System.Net.Sockets.TcpClient The client to write to
data string The string to send.
Результат void

Write() публичный Метод

Writes a byte array to all clients connected.
public Write ( byte bytes ) : void
bytes byte The bytes to send.
Результат void

Write() публичный Метод

Writes a string to all clients connected.
public Write ( string data ) : void
data string The string to send.
Результат void