C# Class Dazzle.Server.AsyncTcpServer

An Asynchronous TCP Server that makes use of system managed threads and callbacks to stop the server ever locking up.
Afficher le fichier Open project: kellabyte/Dazzle.NET

Méthodes publiques

Méthode Description
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.

Méthodes protégées

Méthode Description
HandleData ( byte data, TcpClient client ) : void

Private Methods

Méthode Description
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.

Method Details

AsyncTcpServer() public méthode

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.
Résultat System

AsyncTcpServer() public méthode

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.
Résultat System

HandleData() protected méthode

protected HandleData ( byte data, TcpClient client ) : void
data byte
client System.Net.Sockets.TcpClient
Résultat void

Start() public méthode

Starts the TCP Server listening for new clients.
public Start ( ) : void
Résultat void

Stop() public méthode

Stops the TCP Server listening for new clients and disconnects any currently connected clients.
public Stop ( ) : void
Résultat void

Write() public méthode

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
Résultat void

Write() public méthode

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.
Résultat void

Write() public méthode

Writes a byte array to all clients connected.
public Write ( byte bytes ) : void
bytes byte The bytes to send.
Résultat void

Write() public méthode

Writes a string to all clients connected.
public Write ( string data ) : void
data string The string to send.
Résultat void