private bool CounterConnect(Output other, bool force) { if (!CanConnectTo(other, force ? ConnectionConsiderations.RuleViolation : ConnectionConsiderations.None)) { return(false); } m_connections.Add(other); Connected.Execute(other); return(true); }
public void Connect() { ushort _port = port; string hostname = host.HostName; IPAddress _ip = ip; IPEndPoint endpoint = new IPEndPoint(_ip, _port); try { socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); context = new TransferContext(socket); socket.BeginConnect(endpoint, OnConnectCallback, context); connectNotice.WaitOne(); Connected.Execute(this); } catch (SocketException ex) { } }