C# Class Lidgren.Network.NetPeer

A client which can initiate and accept multiple connections
Inheritance: Lidgren.Network.NetServer
Exibir arquivo Open project: tomoprime/CrabBattle Class Usage Examples

Public Methods

Method Description
CreateMessage ( ) : NetOutgoingMessage

Creates a new message for sending

CreateMessage ( int initialCapacity ) : NetOutgoingMessage

Creates a new message for sending

CreateMessage ( string content ) : NetOutgoingMessage

Creates a new message for sending and writes the provided string to it

Recycle ( NetIncomingMessage msg ) : void

Recycles a NetIncomingMessage instance for reuse; taking pressure off the garbage collector

RegisterReceivedCallback ( SendOrPostCallback callback ) : void

Call this to register a callback for when a new message arrives

SendMessage ( NetOutgoingMessage msg, NetConnection recipient, NetDeliveryMethod method ) : NetSendResult

Send a message to a specific connection

SendMessage ( NetOutgoingMessage msg, NetConnection recipient, NetDeliveryMethod method, int sequenceChannel ) : NetSendResult

Send a message to a specific connection

SendMessage ( NetOutgoingMessage msg, IList recipients, NetDeliveryMethod method, int sequenceChannel ) : void

Send a message to a list of connections

SendUnconnectedMessage ( NetOutgoingMessage msg, IList recipients ) : void

Send a message to an unconnected host

SendUnconnectedMessage ( NetOutgoingMessage msg, IPEndPoint recipient ) : void

Send a message to an unconnected host

SendUnconnectedMessage ( NetOutgoingMessage msg, string host, int port ) : void

Send a message to an unconnected host

Private Methods

Method Description
AcceptConnection ( NetConnection conn ) : void
CreateIncomingMessage ( NetIncomingMessageType tp, byte useStorageData ) : NetIncomingMessage
CreateIncomingMessage ( NetIncomingMessageType tp, int minimumByteSize ) : NetIncomingMessage
CreateIncomingMessage ( NetIncomingMessageType tp, string text ) : NetIncomingMessage

Creates an incoming message with the required capacity for releasing to the application

ExecutePeerShutdown ( ) : void
GetMTU ( IList recipients ) : int
GetStorage ( int minimumCapacity ) : byte[]
HandleIncomingDiscoveryRequest ( double now, IPEndPoint senderEndpoint, int ptr, int payloadByteLength ) : void
HandleIncomingDiscoveryResponse ( double now, IPEndPoint senderEndpoint, int ptr, int payloadByteLength ) : void
Heartbeat ( ) : void
InitializeNetwork ( ) : void
InitializePools ( ) : void
NetworkLoop ( ) : void
ReceivedUnconnectedLibraryMessage ( double now, IPEndPoint senderEndpoint, NetMessageType tp, int ptr, int payloadByteLength ) : void
Recycle ( NetOutgoingMessage msg ) : void
Recycle ( byte storage ) : void
ReleaseMessage ( NetIncomingMessage msg ) : void
SetupReadHelperMessage ( int ptr, int payloadLength ) : NetIncomingMessage
VerifyNetworkThread ( ) : void

Method Details

CreateMessage() public method

Creates a new message for sending
public CreateMessage ( ) : NetOutgoingMessage
return NetOutgoingMessage

CreateMessage() public method

Creates a new message for sending
public CreateMessage ( int initialCapacity ) : NetOutgoingMessage
initialCapacity int initial capacity in bytes
return NetOutgoingMessage

CreateMessage() public method

Creates a new message for sending and writes the provided string to it
public CreateMessage ( string content ) : NetOutgoingMessage
content string
return NetOutgoingMessage

Recycle() public method

Recycles a NetIncomingMessage instance for reuse; taking pressure off the garbage collector
public Recycle ( NetIncomingMessage msg ) : void
msg NetIncomingMessage
return void

RegisterReceivedCallback() public method

Call this to register a callback for when a new message arrives
public RegisterReceivedCallback ( SendOrPostCallback callback ) : void
callback SendOrPostCallback
return void

SendMessage() public method

Send a message to a specific connection
public SendMessage ( NetOutgoingMessage msg, NetConnection recipient, NetDeliveryMethod method ) : NetSendResult
msg NetOutgoingMessage The message to send
recipient NetConnection The recipient connection
method NetDeliveryMethod How to deliver the message
return NetSendResult

SendMessage() public method

Send a message to a specific connection
public SendMessage ( NetOutgoingMessage msg, NetConnection recipient, NetDeliveryMethod method, int sequenceChannel ) : NetSendResult
msg NetOutgoingMessage The message to send
recipient NetConnection The recipient connection
method NetDeliveryMethod How to deliver the message
sequenceChannel int Sequence channel within the delivery method
return NetSendResult

SendMessage() public method

Send a message to a list of connections
public SendMessage ( NetOutgoingMessage msg, IList recipients, NetDeliveryMethod method, int sequenceChannel ) : void
msg NetOutgoingMessage The message to send
recipients IList The list of recipients to send to
method NetDeliveryMethod How to deliver the message
sequenceChannel int Sequence channel within the delivery method
return void

SendUnconnectedMessage() public method

Send a message to an unconnected host
public SendUnconnectedMessage ( NetOutgoingMessage msg, IList recipients ) : void
msg NetOutgoingMessage
recipients IList
return void

SendUnconnectedMessage() public method

Send a message to an unconnected host
public SendUnconnectedMessage ( NetOutgoingMessage msg, IPEndPoint recipient ) : void
msg NetOutgoingMessage
recipient IPEndPoint
return void

SendUnconnectedMessage() public method

Send a message to an unconnected host
public SendUnconnectedMessage ( NetOutgoingMessage msg, string host, int port ) : void
msg NetOutgoingMessage
host string
port int
return void