C# Класс KLFServer.Server

Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
bannedIPs HashSet
clientActivityCountLock object
clientMessageQueue ConcurrentQueue
clients ServerClient[]
commandThread Thread
connectionThread Thread
consoleWriteLock object
httpListener HttpListener
listenThread Thread
outgoingMessageThread Thread
quit bool
savedThrottleStates ServerClient.ThrottleState>.Dictionary
settings ServerSettings
stop bool
stopwatch Stopwatch
tcpListener TcpListener
threadException Exception
threadExceptionLock object
threadExceptionStackTrace String
udpClient UdpClient

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

Метод Описание
Server ( ServerSettings settings ) : System
buildMessageArray ( KLFCommon id, byte data ) : byte[]
clearState ( ) : void
clientActivityLevelChanged ( int index ) : void
clientIsReady ( int index ) : bool
clientIsValid ( int index ) : bool
debugConsoleWriteLine ( String message ) : void
disconnectClient ( int index, String message ) : void
handleClientTextMessage ( int client_index, String message_text ) : void
handleMessage ( int client_index, KLFCommon id, byte data ) : void
hostingLoop ( ) : void
messageFloodIncrement ( int index ) : void
passExceptionToMain ( Exception e ) : void
queueClientMessage ( int client_index, KLFCommon id, byte data ) : void
saveScreenshot ( Screenshot screenshot, String player ) : void
sendOutgoingMessages ( ) : void
stampedConsoleWriteLine ( String message ) : void

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

Метод Описание
addClient ( TcpClient tcp_client ) : int
asyncHTTPCallback ( IAsyncResult result ) : void
asyncUDPReceive ( IAsyncResult result ) : void
banClient ( int index ) : void
banIP ( IPAddress address ) : void
clearBans ( ) : void
getClientIP ( int index ) : IPAddress
getClientIndexByName ( String name ) : int
handleCommands ( ) : void
handleConnections ( ) : void
listenForClients ( ) : void
loadBanList ( ) : void
printCommands ( ) : void
safeAbort ( Thread thread, bool join = false ) : void
saveBanList ( ) : void
sendConnectionEndMessageDirect ( TcpClient client, String message ) : void
sendCraftFile ( int client_index, String craft_name, byte data, byte type ) : void
sendHandshakeMessage ( int client_index ) : void
sendHandshakeRefusalMessageDirect ( TcpClient client, String message ) : void
sendMessageHeaderDirect ( TcpClient client, KLFCommon id, int msg_length ) : void
sendPluginUpdateToAll ( byte data, bool in_flight_only, int exclude_index = -1 ) : void
sendScreenshot ( int client_index, Screenshot screenshot ) : void
sendScreenshotToWatchers ( int client_index, Screenshot screenshot ) : void
sendServerMessage ( int client_index, String message ) : void
sendServerMessageToAll ( String message, int exclude_index = -1 ) : void
sendServerSettings ( int client_index ) : void
sendServerSettingsToAll ( ) : void
sendTextMessage ( int client_index, String message ) : void
sendTextMessageToAll ( String message, int exclude_index = -1 ) : void
serverSettingBytes ( ) : byte[]
unbanIP ( IPAddress address ) : void

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

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

public Server ( ServerSettings settings ) : System
settings ServerSettings
Результат System

buildMessageArray() публичный статический Метод

public static buildMessageArray ( KLFCommon id, byte data ) : byte[]
id KLFCommon
data byte
Результат byte[]

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

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

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

public clientActivityLevelChanged ( int index ) : void
index int
Результат void

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

public clientIsReady ( int index ) : bool
index int
Результат bool

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

public clientIsValid ( int index ) : bool
index int
Результат bool

debugConsoleWriteLine() публичный статический Метод

public static debugConsoleWriteLine ( String message ) : void
message String
Результат void

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

public disconnectClient ( int index, String message ) : void
index int
message String
Результат void

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

public handleClientTextMessage ( int client_index, String message_text ) : void
client_index int
message_text String
Результат void

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

public handleMessage ( int client_index, KLFCommon id, byte data ) : void
client_index int
id KLFCommon
data byte
Результат void

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

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

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

public messageFloodIncrement ( int index ) : void
index int
Результат void

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

public passExceptionToMain ( Exception e ) : void
e Exception
Результат void

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

public queueClientMessage ( int client_index, KLFCommon id, byte data ) : void
client_index int
id KLFCommon
data byte
Результат void

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

public saveScreenshot ( Screenshot screenshot, String player ) : void
screenshot Screenshot
player String
Результат void

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

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

stampedConsoleWriteLine() публичный статический Метод

public static stampedConsoleWriteLine ( String message ) : void
message String
Результат void

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

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

public HashSet bannedIPs
Результат HashSet

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

public object clientActivityCountLock
Результат object

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

public ConcurrentQueue clientMessageQueue
Результат ConcurrentQueue

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

public ServerClient[] clients
Результат ServerClient[]

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

public Thread commandThread
Результат Thread

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

public Thread connectionThread
Результат Thread

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

public static object consoleWriteLock
Результат object

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

public HttpListener httpListener
Результат HttpListener

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

public Thread listenThread
Результат Thread

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

public Thread outgoingMessageThread
Результат Thread

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

public bool quit
Результат bool

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

public Dictionary savedThrottleStates
Результат ServerClient.ThrottleState>.Dictionary

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

public ServerSettings settings
Результат ServerSettings

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

public bool stop
Результат bool

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

public Stopwatch stopwatch
Результат Stopwatch

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

public TcpListener tcpListener
Результат TcpListener

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

public Exception threadException
Результат Exception

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

public object threadExceptionLock
Результат object

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

public String threadExceptionStackTrace
Результат String

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

public UdpClient udpClient
Результат UdpClient