Esempio n. 1
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);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// If <paramref name="callHandlers"/> is true, OnClientMessage 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 OnClientMessage handlers should be called; otherwise false.</param>
        /// <remarks>
        /// Message is not sent immediatly, instead it is queued and sent from client thread.
        /// </remarks>
        public static void SendToServer(byte[] data, bool callHandlers)
        {
            UltimaSocket socket = CommunicationManager.Socket;

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

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

                if (result == CallbackResult.Normal)
                {
                    serverSendLimiter.Send();
                    socket.SendToServer(data);
                }
            }
        }