コード例 #1
0
        public void Connect()
        {
            lock (ClientReplacingMutex)
            {
                if (Client != null)
                {
                    Client.Dispose();
                    TotalBytesReceivedBeforeLastReconnect = GetTotalBytesReceived();
                    TotalBytesSentBeforeLastReconnect     = GetTotalBytesSent();
                    Client = null;
                }
                BroadcastConnectionState(CallbackConnectionState.Connecting);
                try
                {
                    Client = new Network.AsyncTCPXMLClient(Hostname,
                                                           Portnumber,
                                                           Certificate,
                                                           AllowSelfSignedServerCertificate,
                                                           ClientGotData,
                                                           ClientDisconnected);
                }
                catch
                {
                    ClientDisconnected();
                    return;
                }
            }
            OpenXMPPStream();

            if (MyJID.GetResource() == string.Empty)
            {
                MyJID.SetResource(System.Guid.NewGuid().ToString());
            }
            this.RosterMaintainer = new Roster(this);
        }
コード例 #2
0
 public Connection(string Hostname,
                   int Portnumber,
                   JID RequestedJID,
                   string Password,
                   X509Certificate2 Certificate = null)
 {
     this.Hostname   = Hostname;
     this.Portnumber = Portnumber;
     this.MyJID      = RequestedJID;
     if (MyJID.GetResource() == string.Empty)
     {
         MyJID.SetResource(System.Guid.NewGuid().ToString());
     }
     this.Password         = Password;
     this.RosterMaintainer = new Roster(this);
     this.Certificate      = Certificate;
 }
コード例 #3
0
 public Connection(string Hostname,
                   int Portnumber,
                   JID RequestedJID,
                   string Password,
                   X509Certificate2 Certificate          = null,
                   bool AllowSelfSignedServerCertificate = false,
                   int KeepAliveByWhiteSpaceInterval     = 30,
                   int DebugLevel = 0)
 {
     this.Hostname   = Hostname;
     this.Portnumber = Portnumber;
     this.MyJID      = RequestedJID;
     if (MyJID.GetResource() == string.Empty)
     {
         MyJID.SetResource(System.Guid.NewGuid().ToString());
     }
     this.Password         = Password;
     this.RosterMaintainer = new Roster(this);
     this.Certificate      = Certificate;
     this.AllowSelfSignedServerCertificate = AllowSelfSignedServerCertificate;
     this.KeepAliveByWhiteSpaceInterval    = KeepAliveByWhiteSpaceInterval;
     this.DebugLevel = DebugLevel;
 }