Esempio n. 1
0
        /// <summary>
        /// Method used to send asynchronously a message. This method calls the MessageSentCallbak once the send task is completed, but do not get afraid of this callback call, if you have not set a method to the callback it will not be invoked at all.
        /// </summary>
        /// <param name="result"></param>
        public void AsyncSenderCallback(System.IAsyncResult result)
        {
            int           sentBytes;
            NetworkEntity net = null;

            try
            {
                net       = (NetworkEntity)result.AsyncState;
                sentBytes = net.ownerNetworkCollection.socketReference.EndSend(result);
                KSPMGlobals.Globals.Log.WriteTo(sentBytes.ToString());
                if (sentBytes > 0)
                {
                    net.MessageSent(net, null);
                }
            }
            catch (System.Exception)
            {
            }
        }