C# 클래스 Dazzle.Server.AsyncTcpServer

An Asynchronous TCP Server that makes use of system managed threads and callbacks to stop the server ever locking up.
파일 보기 프로젝트 열기: kellabyte/Dazzle.NET

공개 메소드들

메소드 설명
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