void HandleConnectionNotFound(object sender, ConnectionRouter.MissingEventArgs args) { try{ var tcp = new TcpClient(); tcp.Connect(args.EndPoint.ToString(), defaultPort, TimeSpan.FromSeconds(3)); var conn = new Connection(new TcpByteConnection(tcp), this.Serializer); Connect(conn, isOutbound: true); args.Added = true; }catch{} }
public void Connect(string host, int port) { var c = new Connection(new TcpByteConnection( new System.Net.Sockets.TcpClient(host, port)), serializer); Connected.FireEventAsync(c); }