/// <summary> /// Starts flow processing. /// </summary> internal void Start() { // Move processing to thread pool. AutoResetEvent startLock = new AutoResetEvent(false); ThreadPool.QueueUserWorkItem(new WaitCallback(delegate(object state){ lock (m_pLock){ startLock.Set(); // TCP / TLS client, connect to remote end point. if (!m_IsServer && m_Transport != SIP_Transport.UDP) { try{ TCP_Client client = new TCP_Client(); client.Connect(m_pLocalEP, m_pRemoteEP, m_Transport == SIP_Transport.TLS); m_pTcpSession = client; BeginReadHeader(); } catch { Dispose(); } } } })); startLock.WaitOne(); startLock.CloseOrDispose(); }