C# Класс BF2Statistics.Gamespy.Net.GamespyTcpStream

This object is used as a Network Stream wrapper for Gamespy TCP protocol,
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
Connection Socket

Защищенные свойства (Protected)

Свойство Тип Описание
DisconnectEventCalled bool
RecvMessage StringBuilder
SendBytesOffset int
SendMessage List
WaitingOnAsync bool

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

Метод Описание
BeginReceive ( ) : void

Begins the process of receiving a message from the client. This method must manually be called to Begin receiving data

Close ( bool DisposeEventArgs = false ) : void

Closes the underlying socket

Dispose ( ) : void
GamespyTcpStream ( GamespyTcpSocket Parent, SocketAsyncEventArgs ReadArgs, SocketAsyncEventArgs WritetArgs ) : System

Creates a new instance of GamespyTcpStream

SendAsync ( byte message ) : void

Writes a message to the client stream asynchronously

SendAsync ( string message ) : void

Writes a message to the client stream asynchronously

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

Метод Описание
HandleSocketError ( SocketError socketError ) : void

If there was a socket error, it can be handled propery here

IOComplete ( object sender, SocketAsyncEventArgs e ) : void

Event called when data has been recived from the client

ProcessReceive ( ) : void

Once data has been recived from the client, this method is called to process the data. Once a message has been completed, the OnDataReceived event will be called

ProcessSend ( ) : void

Sends a message Asynchronously to the client connection

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

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

Begins the process of receiving a message from the client. This method must manually be called to Begin receiving data
public BeginReceive ( ) : void
Результат void

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

Closes the underlying socket
public Close ( bool DisposeEventArgs = false ) : void
DisposeEventArgs bool /// If true, the EventArg objects will be disposed instead of being re-added to /// the IO pool. This should NEVER be set to true unless we are shutting down the server! ///
Результат void

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

public Dispose ( ) : void
Результат void

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

Creates a new instance of GamespyTcpStream
public GamespyTcpStream ( GamespyTcpSocket Parent, SocketAsyncEventArgs ReadArgs, SocketAsyncEventArgs WritetArgs ) : System
Parent GamespyTcpSocket
ReadArgs System.Net.Sockets.SocketAsyncEventArgs
WritetArgs System.Net.Sockets.SocketAsyncEventArgs
Результат System

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

Writes a message to the client stream asynchronously
public SendAsync ( byte message ) : void
message byte The complete message to be sent to the client
Результат void

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

Writes a message to the client stream asynchronously
public SendAsync ( string message ) : void
message string The complete message to be sent to the client
Результат void

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

Connection публичное свойство

Our connected socket
public Socket Connection
Результат Socket

DisconnectEventCalled защищенное свойство

Indicates whether the OnDisconnect event has been called
protected bool DisconnectEventCalled
Результат bool

RecvMessage защищенное свойство

Our message recieved from the client connection. If the message is too long, it will be sent over multiple receive operations, so we store the message parts here until we recieve the \final\ delimiter.
protected StringBuilder RecvMessage
Результат StringBuilder

SendBytesOffset защищенное свойство

The current send offset when sending asynchronously
protected int SendBytesOffset
Результат int

SendMessage защищенное свойство

Our message to send to the client. If the message is too long, it will be sent over multiple write operations, so we store the message here until its all sent
protected List SendMessage
Результат List

WaitingOnAsync защищенное свойство

Indicates whether we are currently sending a message asynchronously
protected bool WaitingOnAsync
Результат bool