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

boolean CNetChan:CanPacket( )
Returns whether the channel is currently allowed to send a packet, based on its rate limit.
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( )
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:GetDataRate( )
number CNetChan:GetDropNumber( )
Returns the current file denied callback function.
Can be set using CNetChan:SetFileDeniedCallback
Returns the current file received callback function.
Can be set using CNetChan:SetFileReceivedCallback
Returns the current file requested callback function.
Can be set using CNetChan:SetFileRequestedCallback
Returns the current file sent callback function.
Can be set using CNetChan:SetFileSentCallback
Returns the maximum routable payload size of the channel.
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 the current packet end callback function.
Can be set using CNetChan:SetPacketEndCallback
Returns the current packet start callback function.
Can be set using CNetChan:SetPacketStartCallback
Returns true if the channel is currently processing messages.
number CNetChan:GetRate( )
Returns the data rate of the channel in bytes/sec.
Alias of CNetChan:GetDataRate.
Returns the framerate the other side of the channel reports it is running at.
Returns the current should-accept-file callback function.
Can be set using CNetChan:SetShouldAcceptFileCallback
Returns the reliable stream used by net messages.
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.
Processes all pending incoming net messages.
Returns true on success.
number CNetChan:RequestFile( string fileName )
Requests the given file from the other side of the channel.
The result is reported through CNetChan:SetFileReceivedCallback (or CNetChan:SetFileDeniedCallback if the other side denies it), using the returned transfer ID.
boolean CNetChan:SendFile( string fileName, number transferID )
Sends the given file to the other side of the channel.
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:SetFileDeniedCallback( function callback )
Sets the callback function for when a file request was denied by the other side of the channel.
Can be returned using CNetChan:GetFileDeniedCallback
CNetChan:SetFileReceivedCallback( function callback )
Sets the callback function for when a requested file has been fully received.
Can be returned using CNetChan:GetFileReceivedCallback
CNetChan:SetFileRequestedCallback( function callback )
Sets the callback function for when the other side of the channel requests a file for download.
Can be returned using CNetChan:GetFileRequestedCallback
CNetChan:SetFileSentCallback( function callback )
Sets the callback function for when a file has been fully sent to the other side of the channel.
Can be returned using CNetChan:GetFileSentCallback
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:SetPacketEndCallback( function callback )
Sets the callback function that is called once all messages of an incoming packet have been parsed.
Can be returned using CNetChan:GetPacketEndCallback
CNetChan:SetPacketStartCallback( function callback )
Sets the callback function that is called each time a new packet has started arriving on the channel.
Can be returned using CNetChan:GetPacketStartCallback
CNetChan:SetRate( number rate )
Sets the data rate of the channel in bytes/sec.
Alias of CNetChan:SetDataRate.
Sets the callback function that decides whether an incoming file transfer request should be accepted.
If no callback is set, or the callback errors, the file is denied.
Can be returned using CNetChan:GetShouldAcceptFileCallback
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.