UnityEngine.Networking.NetworkConnection.Send C# (CSharp) Method

Send() public method

This sends a network message with a message ID on the connection. This message is sent on channel zero, which by default is the reliable channel.

public Send ( short msgType, MessageBase msg ) : bool
msgType short The ID of the message to send.
msg MessageBase The message to send.
return bool
        public virtual bool Send(short msgType, MessageBase msg)
        {
            return this.SendByChannel(msgType, msg, 0);
        }

Usage Example

コード例 #1
0
        internal void AssignAuthorityCallback(NetworkConnection conn, NetworkIdentity uv, bool authorityState)
        {
            PeerAuthorityMessage msg = new PeerAuthorityMessage {
                connectionId   = conn.connectionId,
                netId          = uv.netId,
                authorityState = authorityState
            };

            if (LogFilter.logDebug)
            {
                Debug.Log("AssignAuthorityCallback send for netId" + uv.netId);
            }
            for (int i = 0; i < NetworkServer.connections.Count; i++)
            {
                NetworkConnection connection = NetworkServer.connections[i];
                if (connection != null)
                {
                    connection.Send(0x12, msg);
                }
            }
        }
All Usage Examples Of UnityEngine.Networking.NetworkConnection::Send