public FindNodeMessage(byte[] data) : base(UdpMessageType.DISCOVER_FIND_NODE, data) { try { this.message = Protocol.FindNeighbours.Parser.ParseFrom(data); } catch (System.Exception e) { Logger.Error(e.Message); } }
public FindNodeMessage(Node from, byte[] target_id) : base(UdpMessageType.DISCOVER_FIND_NODE, null) { Protocol.Endpoint endpoint_from = new Protocol.Endpoint(); endpoint_from.NodeId = ByteString.CopyFrom(from.Id); endpoint_from.Port = from.Port; endpoint_from.Address = ByteString.CopyFrom(Encoding.UTF8.GetBytes(from.Host)); this.message = new Protocol.FindNeighbours(); this.message.From = endpoint_from; this.message.TargetId = ByteString.CopyFrom(target_id); this.message.Timestamp = Helper.CurrentTimeMillis(); this.data = this.message.ToByteArray(); }