C# Class Descent.Messaging.AsyncSockets.AsyncSocketsServer

Implementation of the asynchronous sockets server.
Show file Open project: nezbo/Descent

Public Methods

Method Description
AsyncSocketsServer ( int port ) : System

Initializes a new instance of the AsyncSocketsServer class.

Broadcast ( string message ) : void

Broadcast a string to all connected clients.

BroadcastExceptClient ( string message, int clientId ) : void

Broadcast a string to all connected clients except one.

Close ( ) : void
Start ( ) : void

Start listening and accepting clients.

Private Methods

Method Description
AcceptCallback ( IAsyncResult asyncResult ) : void

Called when a client was connected.

ClientConnectionDisconnected ( ClientInfo clientInfo ) : void

Called when a client disconnects. Removes the client from the collection.

Method Details

AsyncSocketsServer() public method

Initializes a new instance of the AsyncSocketsServer class.
public AsyncSocketsServer ( int port ) : System
port int /// Port that the server should use. ///
return System

Broadcast() public method

Broadcast a string to all connected clients.
public Broadcast ( string message ) : void
message string The string to broadcast
return void

BroadcastExceptClient() public method

Broadcast a string to all connected clients except one.
public BroadcastExceptClient ( string message, int clientId ) : void
message string The string to broadcast
clientId int The client which the server shouldn't send to.
return void

Close() public method

public Close ( ) : void
return void

Start() public method

Start listening and accepting clients.
public Start ( ) : void
return void