// Internal function to start the actual connection establishment. private void StartConnecting() { Debug.Assert(m_s == null); // Create the socket. try { m_s = AsyncSocket.Create(m_addr.Resolved.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp); } catch (SocketException) { AddReconnectTimer(); return; } m_ioObject.AddSocket(m_s); m_handleValid = true; // Connect to the remote peer. try { m_s.Connect(m_addr.Resolved.Address.Address, m_addr.Resolved.Address.Port); m_socket.EventConnectDelayed(m_endpoint, ErrorCode.InProgres); } catch (SocketException ex) { OutCompleted(ex.SocketErrorCode, 0); } }
/// <summary> /// Internal function to start the actual connection establishment. /// </summary> private void StartConnecting() { Debug.Assert(m_s == null); // Create the socket. try { m_s = AsyncSocket.Create(m_addr.Resolved.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp); } catch (SocketException) { AddReconnectTimer(); return; } m_ioObject.AddSocket(m_s); m_handleValid = true; // Connect to the remote peer. try { m_s.Connect(m_addr.Resolved.Address.Address, m_addr.Resolved.Address.Port); m_socket.EventConnectDelayed(m_endpoint, ErrorCode.InProgress); } catch (SocketException ex) { OutCompleted(ex.SocketErrorCode, 0); } // TerminatingException can occur in above call to EventConnectDelayed via // MonitorEvent.Write if corresponding PairSocket has been sent Term command catch (TerminatingException) {} }