# Sandbox.Connection

A connection, usually to a server or a client.

- Kind: class
- Namespace: `Sandbox`
- Assembly: `Sandbox.Engine`
- Modifiers: abstract

## Properties

- [`Address`](/api/Sandbox.Connection/Address)
- [`All`](/api/Sandbox.Connection/All): A list of connections that are currently on this server. If you're not on a server this will return only one connection (Connection.Local). Some games restrict the connection list - in which case you will get an empty list.
- [`CanDestroyObjects`](/api/Sandbox.Connection/CanDestroyObjects): Can this connection destroy networked objects they own?
- [`CanRefreshObjects`](/api/Sandbox.Connection/CanRefreshObjects): Can this connection refresh networked objects that they own?
- [`CanSpawnObjects`](/api/Sandbox.Connection/CanSpawnObjects): Can this connection spawn networked objects?
- [`ConnectionTime`](/api/Sandbox.Connection/ConnectionTime)
- [`DisplayName`](/api/Sandbox.Connection/DisplayName): The player's name but with any potential nicknames or naughty words filtered out. You don't want to be using this in serverside logic really.
- [`FriendInfo`](/api/Sandbox.Connection/FriendInfo): Steam friend information for this connection. This is not available on the dedicated server.
- [`Host`](/api/Sandbox.Connection/Host): The connection of the current network host.
- [`Id`](/api/Sandbox.Connection/Id): This connection's unique identifier.
- [`IsActive`](/api/Sandbox.Connection/IsActive): True if this channel is fully connnected and fully logged on.
- [`IsConnecting`](/api/Sandbox.Connection/IsConnecting): True if this channel is still currently connecting.
- [`IsHost`](/api/Sandbox.Connection/IsHost)
- [`Latency`](/api/Sandbox.Connection/Latency)
- [`Local`](/api/Sandbox.Connection/Local): This is a "fake" connection for the local player. It is passed to RPCs when calling them locally etc.
- [`MessagesRecieved`](/api/Sandbox.Connection/MessagesRecieved): How many messages have been received from this connection?
- [`MessagesSent`](/api/Sandbox.Connection/MessagesSent): How many messages have been sent to this connection?
- [`Name`](/api/Sandbox.Connection/Name): The player's name.
- [`OwnerSteamId`](/api/Sandbox.Connection/OwnerSteamId): The SteamID of the account that actually owns the game in a Steam Family. If not in a Steam Family this is the same as [Sandbox.Connection.SteamId](/api/Sandbox.Connection/SteamId)
- [`PartyId`](/api/Sandbox.Connection/PartyId): The Id of the party that this user is a part of. This can be used to compare to other users to group them into parties.
- [`Ping`](/api/Sandbox.Connection/Ping): The ping of this connection (in milliseconds.)
- [`Stats`](/api/Sandbox.Connection/Stats): Get stats about this connection such as bandwidth usage and how many packets are being sent and received.
- [`SteamId`](/api/Sandbox.Connection/SteamId)
- [`Time`](/api/Sandbox.Connection/Time)

## Methods

- [`DistanceSquared`](/api/Sandbox.Connection/DistanceSquared): Calculate the closest distance (squared) to a position based on the Pvs sources from this [Sandbox.Connection](/api/Sandbox.Connection).
- [`Down`](/api/Sandbox.Connection/Down): Action is currently pressed down for this [Sandbox.Connection](/api/Sandbox.Connection).
- [`Find`](/api/Sandbox.Connection/Find): Find a [Sandbox.Connection](/api/Sandbox.Connection) for a Connection Id.
- [`GetUserData`](/api/Sandbox.Connection/GetUserData)
- [`HasInventoryItem`](/api/Sandbox.Connection/HasInventoryItem): Check if this connection has a specific inventory item in their Steam Inventory
- [`HasPermission`](/api/Sandbox.Connection/HasPermission): Get whether this connection has a specific permission.
- [`Kick`](/api/Sandbox.Connection/Kick): Kick this [Sandbox.Connection](/api/Sandbox.Connection) from the server. Only the host can kick clients.
- [`Pressed`](/api/Sandbox.Connection/Pressed): Action was pressed for this [Sandbox.Connection](/api/Sandbox.Connection) within the current update context.
- [`Released`](/api/Sandbox.Connection/Released): Action was released for this [Sandbox.Connection](/api/Sandbox.Connection) within the current update context.
- [`SendLog`](/api/Sandbox.Connection/SendLog): Log a message to the console for this connection.
- [`SendMessage`](/api/Sandbox.Connection/SendMessage): Send a message to this connection.
- [`SendRequest`](/api/Sandbox.Connection/SendRequest): Send a message to this connection, wait for a response
- [`SendResponse`](/api/Sandbox.Connection/SendResponse): Send a response message to this connection.
