static void Main(string[] args) { // create a new component connection to the given serverdomain, port and password // a password is needed for the most servers for security reasons, if your server runs behind // a firewall or a closed company network then you could allow component connections without password. comp = new XmppComponentConnection("localhost", 5555, "secret"); // The Jid which this component will use comp.ComponentJid = new Jid("test.gnauck.dyndns.org"); // Setup event handlers comp.OnLogin += new ObjectHandler(comp_OnLogin); comp.OnClose += new ObjectHandler(comp_OnClose); comp.OnRoute += new agsXMPP.XmppComponentConnection.RouteHandler(comp_OnRoute); comp.OnReadXml += new XmlHandler(comp_OnReadXml); comp.OnWriteXml += new XmlHandler(comp_OnWriteXml); comp.Open(); Console.ReadLine(); comp.Close(); Console.ReadLine(); Console.WriteLine("And open the Connection again"); comp.Open(); Console.ReadLine(); comp.Close(); Console.ReadLine(); }
static void Main(string[] args) { // create a new component connection to the given serverdomain, port and password // a password is needed for the most servers for security reasons, if your server runs behind // a firewall or a closed company network then you could allow component connections without password. comp = new XmppComponentConnection(HOST, PORT, SECRET); // The Jid which this component will use comp.ComponentJid = new Jid(JID); // Setup event handlers comp.OnLogin += new ObjectHandler(comp_OnLogin); comp.OnClose += new ObjectHandler(comp_OnClose); comp.OnRoute += new agsXMPP.XmppComponentConnection.RouteHandler(comp_OnRoute); comp.OnReadXml += new XmlHandler(comp_OnReadXml); comp.OnWriteXml += new XmlHandler(comp_OnWriteXml); comp.OnMessage += new MessageHandler(comp_OnMessage); comp.OnIq += new IqHandler(comp_OnIq); comp.OnPresence += new PresenceHandler(comp_OnPresence); comp.OnAuthError += new XmppElementHandler(comp_OnAuthError); comp.Open(); Console.ReadLine(); comp.Close(); //////Console.ReadLine(); //////Console.WriteLine("And open the Connection again"); //////comp.Open(); //////Console.ReadLine(); //////comp.Close(); //////Console.ReadLine(); }