C# Class Bricklayer.Client.Networking.NetworkManager

Provides a simple to use interface for sending/recieving Lidgren messages
Show file Open project: Cyral/Bricklayer Class Usage Examples

Public Methods

Method Description
Connect ( string host, int port ) : void

Connects to a given server.

CreateMessage ( ) : NetOutgoingMessage

Creates a NetOutgoingMessage from the interal Client object.

Disconnect ( string reason = "Bye" ) : void

Disconnects from the server.

Dispose ( ) : void

Disposes the NetworkManager

EncodeMessage ( IMessage gameMessage ) : NetOutgoingMessage

Writes an IMessage's packet ID and encodes it's data into a NetOutgoingMessage.

GetConnectionStats ( ) : NetConnectionStatistics

Gets the server connection's Statistics from the internal client

GetConnectionStatus ( ) : NetConnectionStatus

Gets the connection status from the internal client

GetPeerStats ( ) : NetPeerStatistics

Gets the client statistics from the internal client

GetPeerStatus ( ) : NetPeerStatus

Gets the client status from the internal client

ReadMessage ( ) : NetIncomingMessage

Reads the latest message in the queue.

Recycle ( NetIncomingMessage im ) : void

Recycles a message after processing by reusing it, reducing GC load

Send ( IMessage gameMessage ) : void

Sends and encodes an IMessage to the server.

Private Methods

Method Description
Dispose ( bool disposing ) : void

Disposes the connection and disconnects from the server

Join ( string host, int port ) : void

Sends a message once connected to join a server officially.

Method Details

Connect() public method

Connects to a given server.
public Connect ( string host, int port ) : void
host string
port int
return void

CreateMessage() public method

Creates a NetOutgoingMessage from the interal Client object.
public CreateMessage ( ) : NetOutgoingMessage
return Lidgren.Network.NetOutgoingMessage

Disconnect() public method

Disconnects from the server.
public Disconnect ( string reason = "Bye" ) : void
reason string Reason to tell the server for disconnecting.
return void

Dispose() public method

Disposes the NetworkManager
public Dispose ( ) : void
return void

EncodeMessage() public method

Writes an IMessage's packet ID and encodes it's data into a NetOutgoingMessage.
public EncodeMessage ( IMessage gameMessage ) : NetOutgoingMessage
gameMessage IMessage
return Lidgren.Network.NetOutgoingMessage

GetConnectionStats() public method

Gets the server connection's Statistics from the internal client
public GetConnectionStats ( ) : NetConnectionStatistics
return Lidgren.Network.NetConnectionStatistics

GetConnectionStatus() public method

Gets the connection status from the internal client
public GetConnectionStatus ( ) : NetConnectionStatus
return NetConnectionStatus

GetPeerStats() public method

Gets the client statistics from the internal client
public GetPeerStats ( ) : NetPeerStatistics
return Lidgren.Network.NetPeerStatistics

GetPeerStatus() public method

Gets the client status from the internal client
public GetPeerStatus ( ) : NetPeerStatus
return NetPeerStatus

ReadMessage() public method

Reads the latest message in the queue.
public ReadMessage ( ) : NetIncomingMessage
return Lidgren.Network.NetIncomingMessage

Recycle() public method

Recycles a message after processing by reusing it, reducing GC load
public Recycle ( NetIncomingMessage im ) : void
im Lidgren.Network.NetIncomingMessage Message to recylce
return void

Send() public method

Sends and encodes an IMessage to the server.
public Send ( IMessage gameMessage ) : void
gameMessage IMessage IMessage to write ID and send.
return void