private void DoKeepAlive(object state) { if ((m_sock != null) && this.Connected && ((int)m_listener[Options.CURRENT_KEEP_ALIVE] > 0)) { LoggingHelper.AppendWithLimit(this.logger, MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name, m_sock?.Connected.ToString()); if (((KeepAliveBehavior)m_listener[Options.KEEP_ALIVE_BEHAVIOR]) == KeepAliveBehavior.SpaceCharacter) { m_sock.Write(new byte[] { 32 }); } else { jabber.protocol.iq.PingIQ pingIQ = new protocol.iq.PingIQ(new XmlDocument()); pingIQ.From = (JID)m_listener[Options.JID]; Write(pingIQ.OuterXml); } } }