C# Класс 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.
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
DefaultReceiveBufferSize int

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
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

Описание методов

BeginConnect() публичный Метод

Starts connecting to the given address.
public BeginConnect ( IPEndPoint addr ) : void
addr System.Net.IPEndPoint
Результат void

BeginConnect() публичный Метод

Starts connecting to the given host and port.
public BeginConnect ( string addr, int port ) : void
addr string
port int
Результат void

Connection() публичный Метод

public Connection ( ) : System
Результат System

Disconnect() публичный Метод

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
Результат void

DisconnectNow() публичный Метод

Disconnects this Client and releases all Resources after current read and send operations finished.
public DisconnectNow ( ) : bool
Результат bool

Send() публичный Метод

Sends the information from the given ByteBuffer to the current RemoteEndPoint.
public Send ( ByteBuffer buf ) : void
buf ByteBuffer
Результат void

Send() публичный Метод

Sends the whole byte array to the current RemoteEndPoint.
public Send ( byte buf ) : void
buf byte
Результат void

Send() публичный Метод

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
Результат void

Send() публичный Метод

Sends string.Format(format.ToString(), args) to the current RemoteEndPoint.
public Send ( object format ) : void
format object
Результат void

SendLine() публичный Метод

Sends a line to the current RemoteEndPoint.
public SendLine ( object format ) : void
format object
Результат void

SendNow() публичный Метод

public SendNow ( ByteBuffer buf ) : void
buf ByteBuffer
Результат void

SendNow() публичный Метод

Sends string.Format(format.ToString(), args) to the current RemoteEndPoint.
public SendNow ( object format ) : void
format object
Результат void

SendNow() публичный Метод

Sends string.Format(format.ToString(), args) to the current RemoteEndPoint.
public SendNow ( string text ) : void
text string
Результат void

ToString() публичный Метод

public ToString ( ) : string
Результат string

Описание свойств

DefaultReceiveBufferSize публичное статическое свойство

public static int DefaultReceiveBufferSize
Результат int