コード例 #1
0
        /// <summary>
        /// Sends data directly to the client.
        /// </summary>
        /// <param name="data">Buffer to send.</param>
        public static void SendToClient(byte[] data)
        {
            UltimaSocket socket = CommunicationManager.Socket;

            if (socket != null)
            {
                socket.SendToClient(data);
            }
        }
コード例 #2
0
        /// <summary>
        /// Sends data directly to the server.
        /// </summary>
        /// <param name="data">Buffer to send.</param>
        /// <remarks>
        /// Message is not sent immediatly, instead it is queued and sent from client thread.
        /// </remarks>
        public static void SendToServer(byte[] data)
        {
            UltimaSocket socket = CommunicationManager.Socket;

            if (socket != null)
            {
                serverSendLimiter.Send();
                socket.SendToServer(data);
            }
        }
コード例 #3
0
        /// <summary>
        /// If <paramref name="callHandlers"/> is true, OnServerMessage handlers are called and
        /// if result is <see cref="CallbackResult.Normal"/> data are sent to the client.
        /// </summary>
        /// <param name="data">Buffer to send.</param>
        /// <param name="callHandlers">True if OnServerMessage handlers should be called; otherwise false.</param>
        public static void SendToClient(byte[] data, bool callHandlers)
        {
            UltimaSocket socket = CommunicationManager.Socket;

            if (socket != null)
            {
                CallbackResult result = CallbackResult.Normal;

                if (callHandlers)
                {
                    result = OnServerMessage(data, CallbackResult.Normal);
                }

                if (result == CallbackResult.Normal)
                {
                    socket.SendToClient(data);
                }
            }
        }