Garry's Mod Wiki




Sends the current message to the server.

Each net message has a length limit of 65,533 bytes (approximately 64 KiB) and your net message will error and fail to send if it is larger than this.

The message name must be pooled with util.AddNetworkString beforehand!


Sends a simple hello_world message with the string Hi to the server

net.Start( "hello_world" ) net.WriteString( "Hi" ) net.SendToServer()
Output: The network message hello_world is sent to the server. The server can handle this with net.Receive.

Remember that any client has the potential to send any net message at any time. Don't trust the client-side! On your server-side net.Receive, make sure to verify the message sender's permissions whenever you can and prevent expensive functions from being run too often.