C# Class KLFServer.Server

Show file Open project: SodiumEyes/KerbalLiveFeed Class Usage Examples

Public Properties

Property Type Description
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

Public Methods

Method Description
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

Private Methods

Method Description
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

Method Details

Server() public method

public Server ( ServerSettings settings ) : System
settings ServerSettings
return System

buildMessageArray() public static method

public static buildMessageArray ( KLFCommon id, byte data ) : byte[]
id KLFCommon
data byte
return byte[]

clearState() public method

public clearState ( ) : void
return void

clientActivityLevelChanged() public method

public clientActivityLevelChanged ( int index ) : void
index int
return void

clientIsReady() public method

public clientIsReady ( int index ) : bool
index int
return bool

clientIsValid() public method

public clientIsValid ( int index ) : bool
index int
return bool

debugConsoleWriteLine() public static method

public static debugConsoleWriteLine ( String message ) : void
message String
return void

disconnectClient() public method

public disconnectClient ( int index, String message ) : void
index int
message String
return void

handleClientTextMessage() public method

public handleClientTextMessage ( int client_index, String message_text ) : void
client_index int
message_text String
return void

handleMessage() public method

public handleMessage ( int client_index, KLFCommon id, byte data ) : void
client_index int
id KLFCommon
data byte
return void

hostingLoop() public method

public hostingLoop ( ) : void
return void

messageFloodIncrement() public method

public messageFloodIncrement ( int index ) : void
index int
return void

passExceptionToMain() public method

public passExceptionToMain ( Exception e ) : void
e Exception
return void

queueClientMessage() public method

public queueClientMessage ( int client_index, KLFCommon id, byte data ) : void
client_index int
id KLFCommon
data byte
return void

saveScreenshot() public method

public saveScreenshot ( Screenshot screenshot, String player ) : void
screenshot Screenshot
player String
return void

sendOutgoingMessages() public method

public sendOutgoingMessages ( ) : void
return void

stampedConsoleWriteLine() public static method

public static stampedConsoleWriteLine ( String message ) : void
message String
return void

Property Details

bannedIPs public property

public HashSet bannedIPs
return HashSet

clientActivityCountLock public property

public object clientActivityCountLock
return object

clientMessageQueue public property

public ConcurrentQueue clientMessageQueue
return ConcurrentQueue

clients public property

public ServerClient[] clients
return ServerClient[]

commandThread public property

public Thread commandThread
return Thread

connectionThread public property

public Thread connectionThread
return Thread

consoleWriteLock public static property

public static object consoleWriteLock
return object

httpListener public property

public HttpListener httpListener
return HttpListener

listenThread public property

public Thread listenThread
return Thread

outgoingMessageThread public property

public Thread outgoingMessageThread
return Thread

quit public property

public bool quit
return bool

savedThrottleStates public property

public Dictionary savedThrottleStates
return ServerClient.ThrottleState>.Dictionary

settings public property

public ServerSettings settings
return ServerSettings

stop public property

public bool stop
return bool

stopwatch public property

public Stopwatch stopwatch
return Stopwatch

tcpListener public property

public TcpListener tcpListener
return TcpListener

threadException public property

public Exception threadException
return Exception

threadExceptionLock public property

public object threadExceptionLock
return object

threadExceptionStackTrace public property

public String threadExceptionStackTrace
return String

udpClient public property

public UdpClient udpClient
return UdpClient