HolyLib Wiki

CNetChan

CNetChan

Metatable function Description
__tostring Returns a formated string of the CNetChan -> CNetChan [channel name]
__index Used to find the functions on the metatable and access saved variables
__newindex Used to allow one to save variables on the object

Methods

string CNetChan:GetAddress( )
Returns the Address as ip:port
number CNetChan:GetAvgChoke( number flow )
number CNetChan:GetAvgData( number flow )
number CNetChan:GetAvgLatency( number flow )
number CNetChan:GetAvgLoss( number flow )
number CNetChan:GetAvgPackets( number flow )
number CNetChan:GetBufferSize( )
number CNetChan:GetChallengeNr( )
Returns the challenge number.
number CNetChan:GetClearTime( )
Returns the current connection closing callback function.
Can be set using CNetChan:SetConnectionClosingCallback
Returns the current connection crashed callback function.
Can be set using CNetChan:SetConnectionCrashedCallback
Returns the current connection start callback function.
Can be set using CNetChan:SetConnectionStartCallback
number CNetChan:GetConnectTime( )
number CNetChan:GetDataRate( )
number CNetChan:GetDropNumber( )
number CNetChan:GetInSequenceNr( )
number CNetChan:GetLastReceived( )
Returns the current message callback function.
Can be set using CNetChan:SetMessageCallback
string CNetChan:GetName( )
Returns the name of the channel.
Normally ip:port
Returns true if the channel is currently processing messages.
Returns the reliable stream used by net messages.
number CNetChan:GetStreamSocket( )
Returns the unreliable stream used by net messages.
Returns the voice stream used by the voice chat. This function errors if the client doesn't have a valid CNetChannel
table CNetChan:GetTable( )
Returns the lua table used by newindex and index
number CNetChan:GetTime( )
number CNetChan:GetTimeout( )
number CNetChan:GetTotalData( number flow )
boolean CNetChan:IsValid( )
Returns true if the channel is valid.
boolean CNetChan:ProcessStream( )
Processes all pending incoming net messages.
Returns true on success.
boolean CNetChan:SendMessage( bf_write buffer, boolean reliable = false )
Sends out the given buffer as a message.
Returns true on success.
CNetChan:SetChoked()
CNetChan:SetCompressionMode( boolean compression = false )
Sets the callback function for when a connection is closed.
Can be returned using CNetChan:GetConnectionClosingCallback
Sets the callback function for when a connection has crashed.
Can be returned using CNetChan:GetConnectionCrashedCallback
CNetChan:SetConnectionStartCallback( function callback )
Sets the callback function for when the connection was established.
Can be returned using CNetChan:GetConnectionStartCallback
CNetChan:SetDataRate( number rate )
CNetChan:SetFileTransmissionMode( boolean backgroundTransmission = false )
CNetChan:SetMaxBufferSize( boolean reliable = false, number bytes, boolean voice = false )
Resizes the specified buffer to the given size in bytes. All data inside that stream is discarded, make sure everything was sent out.
CNetChan:SetMessageCallback( function callback )
Sets the callback function for any incomming messages.
Can be returned using CNetChan:GetMessageCallback
CNetChan:SetTimeout( number seconds )
Sets the time in seconds before the channel is marked as timing out.
CNetChan:Shutdown( string reason = nil )
Shuts down the channel.
boolean CNetChan:Transmit( boolean onlyReliable = false, number fragments = -1, boolean freeSubChannels = false )
Transmit any pending data to the channel.
Returns true on success.