Title: Java Bitcoin-Client - IPv4 to IPv6 Post by: husel2000 on June 17, 2015, 01:01:19 PM Hello,
first, i am sorry for my english. Its not very good. Now to my problem: I am trying to create a minimal Bitcoin-Client to Connect to other (Test-)Nodes in Java. At the moment, i can connect to other Nodes and send Messages, defined in https://bitcoin.org/en/developer-reference#p2p-network (https://bitcoin.org/en/developer-reference#p2p-network). My Problem is in the version-Message, specially the addr_recv IP address (16 Bytes). Can someone give me a hint, how to generate a IPv6-Adress from IPv4 (127.0.0.1)? Why is that addr_recv IP address needed? If i connect to one Node, an send 16 Bytes of 0x00 then there is no error and whe can confirm the Connection with the verack-Message. Thanks for your help and explanation. Greets Husel Title: Re: Java Bitcoin-Client - IPv4 to IPv6 Post by: achow101 on June 17, 2015, 03:28:59 PM An IPv4 address mapped to IPv6 will look like this
Code: ::ffff:127.0.0.1 Code: {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x82,0xd3,0xb1,0xbe} Title: Re: Java Bitcoin-Client - IPv4 to IPv6 Post by: husel2000 on June 18, 2015, 09:58:37 AM Thanks!
The other Question: What is it used for? I only send 0x00 and everything seems to work fine. BTW: I am missing the THX-Button to avoid these posts... Title: Re: Java Bitcoin-Client - IPv4 to IPv6 Post by: grau on June 18, 2015, 02:24:13 PM Here is a fragment that works for me. Not complete but you get the idea how to deal with ipv4 or 6.
It is used to connect you, assuming your node was accepting incoming connections. If so, you should indicate in the service bits. Code: Address a; |