HolyLib Wiki

Transmit

  boolean CBaseClient:Transmit( boolean onlyReliable = false, number fragments = -1, boolean freeSubChannels = false )

Description

Transmit any pending data to the client.
Returns true on success.

This function errors if the client doesn't have a valid CNetChannel
Transmitting data to the client causes the client's prediction to reset and cause prediction errors!

Recently Changed

This was recently changed in version (0.8 - DEV).

The second argument fragments was removed

Arguments

1boolean onlyReliable = false
If true only the reliable stream is transmitted
2number fragments = -1

Number of fragments to use.
the engine by default uses only 4 fragments (depends on net_maxfragments & raising it increases the number of fragments)
You can use up to 7 fragments at once as the engine doesn't support more.

Using more fragments increases the networking speed at no cost.

3boolean freeSubChannels = false

Each CNetChannel has 8 sub channels for networking, on every transmit it uses a single sub channel and sends data.
The used sub channel is marked as used and the server waits until the client sends a signal that the sub channel data was received
This argument causes all sub channels to be marked as free instantly after this transmit, making networking possibly unreliable but allowing for far greater speeds.

Returns

1boolean success

Example

Exampe usage of this function
concommand.Add("nukechannel", function(ply) local string = "" for k = 1, 65532 do string = string .. "a" end util.AddNetworkString("Example") for k = 1, 10 do net.Start("Example", false) net.WriteString(string) net.Broadcast() gameserver.GetClient(ply:EntIndex()-1):Transmit() -- Forces the message to be transmitted directly avoiding a overflow. end end)