示例#1
0
        private void SendCallback(IAsyncResult ar)
        {
            try
            {
                int bytesSent = ConnectionSocket.EndSend(ar);
            }
            catch (ObjectDisposedException objex)
            {
                XML.Rosters.ChangeStatus(this.Username, this.UserStatusText, this.UserStatus, false);
                Users.Online.Remove(this);
                XML.Rosters.SendStatus(this.Username);

                LogTools.Write(this.SessionId, objex, "Connection.SendCallback");
            }
            catch (SocketException sockex)
            {
                if (sockex.ErrorCode == 10054)
                {
                    XML.Rosters.ChangeStatus(this.Username, this.UserStatusText, this.UserStatus, false);
                    Users.Online.Remove(this);
                    XML.Rosters.SendStatus(this.Username);
                }
                else
                {
                    LogTools.Write(this.SessionId, sockex, "Connection.SendCallback");
                }
            }
            catch (Exception ex)
            {
                LogTools.Write(this.SessionId, ex, "Connection.SendCallback");
            }
        }
        private void SendCallback(IAsyncResult ar)
        {
            try
            {
                // Retrieve the socket from the state object.
                String S = (string)ar.AsyncState;

                // Complete sending the data to the remote device.
                int bytesSent = ConnectionSocket.EndSend(ar);
                ConnStats.LastComm.Restart();
                ConnStats.Sentpackets++;
            }
            catch
            {
                ReportError?.Invoke("EndSend failed in ConnectionBase.SendCallback", Address);
            }
        }