C# Class Squishy.Network.Connection

Represents an asynchronous TCP Connection that is synchronized for all critical operations. None of its methods are blocking. Therefore most actions are not completed when returning from a method but should be handled using the given events of this class. If this Connection is throttled, its Throttle will take care of the buffer size management. In that state it is illegal to change the buffersize of the throttled buffers (send- and/or receive- buffer respectively) since the throttling depends on a correctly adjusted buffersize.
Datei anzeigen Open project: jaddie/WCell-Utility-Bot Class Usage Examples

Public Properties

Property Type Description
DefaultReceiveBufferSize int

Public Methods

Method Description
BeginConnect ( IPEndPoint addr ) : void

Starts connecting to the given address.

BeginConnect ( string addr, int port ) : void

Starts connecting to the given host and port.

Connection ( ) : System
Disconnect ( ) : void

Marks this Connection Closing. If any data is pending to be sent it will disconnect after this data has been sent, else it will immediately call DisconnectNow.

DisconnectNow ( ) : bool

Disconnects this Client and releases all Resources after current read and send operations finished.

Send ( ByteBuffer buf ) : void

Sends the information from the given ByteBuffer to the current RemoteEndPoint.

Send ( byte buf ) : void

Sends the whole byte array to the current RemoteEndPoint.

Send ( byte buf, int offset, int length ) : void

Sends the contents of the given byte array to the current RemoteEndPoint, using the given offset and length.

Send ( object format ) : void

Sends string.Format(format.ToString(), args) to the current RemoteEndPoint.

SendLine ( object format ) : void

Sends a line to the current RemoteEndPoint.

SendNow ( ByteBuffer buf ) : void
SendNow ( object format ) : void

Sends string.Format(format.ToString(), args) to the current RemoteEndPoint.

SendNow ( string text ) : void

Sends string.Format(format.ToString(), args) to the current RemoteEndPoint.

ToString ( ) : string

Private Methods

Method Description
BeginReceive ( ) : void
CalculateDownBps ( ) : int
CalculateUpBps ( ) : int
ConnectFailNotify ( Exception e ) : void
ConnectedNotify ( ) : void
ConnectingNotify ( ) : void
Connection ( Socket s ) : System
ContinueConnect ( ) : void
ContinueRead ( ) : void
ContinueReadUnlocked ( ) : void
ContinueSend ( ) : void
DisconnectNow ( bool connectionLost ) : bool
DisconnectedNotify ( bool connectionLost ) : void
DisconnectingNotify ( bool connectionLost ) : void
OnConnected ( IAsyncResult ar ) : void
OnRecieved ( IAsyncResult ar ) : void
OnResolved ( IAsyncResult ar ) : void
OnSend ( IAsyncResult ar ) : void
ReceivedNotify ( ByteBuffer buf ) : void
SentNotify ( int amount, bool hasRemaining ) : void
SetRcvBufferSize ( int value, bool throttleAccess ) : void
SetSendBufferSize ( int value, bool throttleAcces ) : void
SetThrottle ( Throttle newThrottle ) : void

Method Details

BeginConnect() public method

Starts connecting to the given address.
public BeginConnect ( IPEndPoint addr ) : void
addr System.Net.IPEndPoint
return void

BeginConnect() public method

Starts connecting to the given host and port.
public BeginConnect ( string addr, int port ) : void
addr string
port int
return void

Connection() public method

public Connection ( ) : System
return System

Disconnect() public method

Marks this Connection Closing. If any data is pending to be sent it will disconnect after this data has been sent, else it will immediately call DisconnectNow.
public Disconnect ( ) : void
return void

DisconnectNow() public method

Disconnects this Client and releases all Resources after current read and send operations finished.
public DisconnectNow ( ) : bool
return bool

Send() public method

Sends the information from the given ByteBuffer to the current RemoteEndPoint.
public Send ( ByteBuffer buf ) : void
buf ByteBuffer
return void

Send() public method

Sends the whole byte array to the current RemoteEndPoint.
public Send ( byte buf ) : void
buf byte
return void

Send() public method

Sends the contents of the given byte array to the current RemoteEndPoint, using the given offset and length.
public Send ( byte buf, int offset, int length ) : void
buf byte
offset int
length int
return void

Send() public method

Sends string.Format(format.ToString(), args) to the current RemoteEndPoint.
public Send ( object format ) : void
format object
return void

SendLine() public method

Sends a line to the current RemoteEndPoint.
public SendLine ( object format ) : void
format object
return void

SendNow() public method

public SendNow ( ByteBuffer buf ) : void
buf ByteBuffer
return void

SendNow() public method

Sends string.Format(format.ToString(), args) to the current RemoteEndPoint.
public SendNow ( object format ) : void
format object
return void

SendNow() public method

Sends string.Format(format.ToString(), args) to the current RemoteEndPoint.
public SendNow ( string text ) : void
text string
return void

ToString() public method

public ToString ( ) : string
return string

Property Details

DefaultReceiveBufferSize public_oe static_oe property

public static int DefaultReceiveBufferSize
return int